<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qpainter.cpp -->
  <title>QPainter Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QPainter</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#settings">Settings</a></li>
<li class="level2"><a href="#drawing">Drawing</a></li>
<li class="level2"><a href="#drawing-pixmaps-and-images">Drawing Pixmaps and Images</a></li>
<li class="level2"><a href="#rendering-quality">Rendering Quality</a></li>
<li class="level2"><a href="#coordinate-transformations">Coordinate Transformations</a></li>
<li class="level2"><a href="#clipping">Clipping</a></li>
<li class="level2"><a href="#composition-modes">Composition Modes</a></li>
<li class="level2"><a href="#limitations">Limitations</a></li>
<li class="level2"><a href="#performance">Performance</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QPainter Class</h1>
<!-- $$$QPainter-brief -->
<p>The QPainter class performs low-level painting on widgets and other paint devices. <a href="#details">More...</a></p>
<!-- @@@QPainter -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QPainter&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="../qtwidgets/qstylepainter.html">QStylePainter</a></p>
</td></tr></table></div><ul>
<li><a href="qpainter-members.html">List of all members, including inherited members</a></li>
<li><a href="qpainter-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are <a href="../qtdoc/threads-reentrancy.html">reentrant</a>.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qpainter-pixmapfragment.html">PixmapFragment</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#CompositionMode-enum">CompositionMode</a></b> { CompositionMode_SourceOver, CompositionMode_DestinationOver, CompositionMode_Clear, CompositionMode_Source, CompositionMode_Destination, &hellip;, RasterOp_SourceOrNotDestination }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#PixmapFragmentHint-enum">PixmapFragmentHint</a></b> { OpaqueHint }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#PixmapFragmentHint-enum">PixmapFragmentHints</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#RenderHint-enum">RenderHint</a></b> { Antialiasing, TextAntialiasing, SmoothPixmapTransform, HighQualityAntialiasing, NonCosmeticDefaultPen, &hellip;, LosslessImageRendering }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#RenderHint-enum">RenderHints</a></b></td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#QPainter-1">QPainter</a></b>(QPaintDevice *<i>device</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#QPainter">QPainter</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#dtor.QPainter">~QPainter</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QBrush &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#background">background</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::BGMode </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#backgroundMode">backgroundMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#begin">begin</a></b>(QPaintDevice *<i>device</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#beginNativePainting">beginNativePainting</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#boundingRect">boundingRect</a></b>(const QRectF &amp;<i>rectangle</i>, int <i>flags</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#boundingRect-1">boundingRect</a></b>(const QRect &amp;<i>rectangle</i>, int <i>flags</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#boundingRect-2">boundingRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>flags</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#boundingRect-3">boundingRect</a></b>(const QRectF &amp;<i>rectangle</i>, const QString &amp;<i>text</i>, const QTextOption &amp;<i>option</i> = QTextOption())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QBrush &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#brush">brush</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#brushOrigin">brushOrigin</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#clipBoundingRect">clipBoundingRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#clipPath">clipPath</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#clipRegion">clipRegion</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#combinedTransform">combinedTransform</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainter::CompositionMode </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#compositionMode">compositionMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPaintDevice *</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#device">device</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#deviceTransform">deviceTransform</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawArc">drawArc</a></b>(const QRectF &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawArc-1">drawArc</a></b>(const QRect &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawArc-2">drawArc</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawChord">drawChord</a></b>(const QRectF &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawChord-1">drawChord</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawChord-2">drawChord</a></b>(const QRect &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a></b>(const QPointF *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawConvexPolygon-1">drawConvexPolygon</a></b>(const QPolygonF &amp;<i>polygon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawConvexPolygon-2">drawConvexPolygon</a></b>(const QPoint *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawConvexPolygon-3">drawConvexPolygon</a></b>(const QPolygon &amp;<i>polygon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawEllipse">drawEllipse</a></b>(const QRectF &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawEllipse-1">drawEllipse</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawEllipse-2">drawEllipse</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawEllipse-3">drawEllipse</a></b>(const QPointF &amp;<i>center</i>, qreal <i>rx</i>, qreal <i>ry</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawEllipse-4">drawEllipse</a></b>(const QPoint &amp;<i>center</i>, int <i>rx</i>, int <i>ry</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawGlyphRun">drawGlyphRun</a></b>(const QPointF &amp;<i>position</i>, const QGlyphRun &amp;<i>glyphs</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage">drawImage</a></b>(const QRectF &amp;<i>target</i>, const QImage &amp;<i>image</i>, const QRectF &amp;<i>source</i>, Qt::ImageConversionFlags <i>flags</i> = Qt::AutoColor)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-1">drawImage</a></b>(const QRect &amp;<i>target</i>, const QImage &amp;<i>image</i>, const QRect &amp;<i>source</i>, Qt::ImageConversionFlags <i>flags</i> = Qt::AutoColor)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-2">drawImage</a></b>(const QPointF &amp;<i>point</i>, const QImage &amp;<i>image</i>, const QRectF &amp;<i>source</i>, Qt::ImageConversionFlags <i>flags</i> = ...)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-3">drawImage</a></b>(const QPoint &amp;<i>point</i>, const QImage &amp;<i>image</i>, const QRect &amp;<i>source</i>, Qt::ImageConversionFlags <i>flags</i> = ...)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-4">drawImage</a></b>(const QRectF &amp;<i>rectangle</i>, const QImage &amp;<i>image</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-5">drawImage</a></b>(const QRect &amp;<i>rectangle</i>, const QImage &amp;<i>image</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-6">drawImage</a></b>(const QPointF &amp;<i>point</i>, const QImage &amp;<i>image</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-7">drawImage</a></b>(const QPoint &amp;<i>point</i>, const QImage &amp;<i>image</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawImage-8">drawImage</a></b>(int <i>x</i>, int <i>y</i>, const QImage &amp;<i>image</i>, int <i>sx</i> = 0, int <i>sy</i> = 0, int <i>sw</i> = -1, int <i>sh</i> = -1, Qt::ImageConversionFlags <i>flags</i> = Qt::AutoColor)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLine">drawLine</a></b>(const QLineF &amp;<i>line</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLine-1">drawLine</a></b>(const QLine &amp;<i>line</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLine-2">drawLine</a></b>(int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLine-3">drawLine</a></b>(const QPoint &amp;<i>p1</i>, const QPoint &amp;<i>p2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLine-4">drawLine</a></b>(const QPointF &amp;<i>p1</i>, const QPointF &amp;<i>p2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines">drawLines</a></b>(const QLineF *<i>lines</i>, int <i>lineCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-1">drawLines</a></b>(const QVector&lt;QLineF&gt; &amp;<i>lines</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-2">drawLines</a></b>(const QPointF *<i>pointPairs</i>, int <i>lineCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-3">drawLines</a></b>(const QVector&lt;QPointF&gt; &amp;<i>pointPairs</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-4">drawLines</a></b>(const QLine *<i>lines</i>, int <i>lineCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-5">drawLines</a></b>(const QVector&lt;QLine&gt; &amp;<i>lines</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-6">drawLines</a></b>(const QPoint *<i>pointPairs</i>, int <i>lineCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawLines-7">drawLines</a></b>(const QVector&lt;QPoint&gt; &amp;<i>pointPairs</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPath">drawPath</a></b>(const QPainterPath &amp;<i>path</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPicture">drawPicture</a></b>(const QPointF &amp;<i>point</i>, const QPicture &amp;<i>picture</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPicture-1">drawPicture</a></b>(int <i>x</i>, int <i>y</i>, const QPicture &amp;<i>picture</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPicture-2">drawPicture</a></b>(const QPoint &amp;<i>point</i>, const QPicture &amp;<i>picture</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPie">drawPie</a></b>(const QRectF &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPie-1">drawPie</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPie-2">drawPie</a></b>(const QRect &amp;<i>rectangle</i>, int <i>startAngle</i>, int <i>spanAngle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap">drawPixmap</a></b>(const QRectF &amp;<i>target</i>, const QPixmap &amp;<i>pixmap</i>, const QRectF &amp;<i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-1">drawPixmap</a></b>(const QRect &amp;<i>target</i>, const QPixmap &amp;<i>pixmap</i>, const QRect &amp;<i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-2">drawPixmap</a></b>(int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, const QPixmap &amp;<i>pixmap</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-3">drawPixmap</a></b>(int <i>x</i>, int <i>y</i>, const QPixmap &amp;<i>pixmap</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-4">drawPixmap</a></b>(const QPointF &amp;<i>point</i>, const QPixmap &amp;<i>pixmap</i>, const QRectF &amp;<i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-5">drawPixmap</a></b>(const QPoint &amp;<i>point</i>, const QPixmap &amp;<i>pixmap</i>, const QRect &amp;<i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-6">drawPixmap</a></b>(const QPointF &amp;<i>point</i>, const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-7">drawPixmap</a></b>(const QPoint &amp;<i>point</i>, const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-8">drawPixmap</a></b>(int <i>x</i>, int <i>y</i>, const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-9">drawPixmap</a></b>(const QRect &amp;<i>rectangle</i>, const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmap-10">drawPixmap</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPixmapFragments">drawPixmapFragments</a></b>(const QPainter::PixmapFragment *<i>fragments</i>, int <i>fragmentCount</i>, const QPixmap &amp;<i>pixmap</i>, QPainter::PixmapFragmentHints <i>hints</i> = PixmapFragmentHints())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoint">drawPoint</a></b>(const QPointF &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoint-1">drawPoint</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoint-2">drawPoint</a></b>(int <i>x</i>, int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoints">drawPoints</a></b>(const QPointF *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoints-1">drawPoints</a></b>(const QPolygonF &amp;<i>points</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoints-2">drawPoints</a></b>(const QPoint *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPoints-3">drawPoints</a></b>(const QPolygon &amp;<i>points</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolygon">drawPolygon</a></b>(const QPointF *<i>points</i>, int <i>pointCount</i>, Qt::FillRule <i>fillRule</i> = Qt::OddEvenFill)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolygon-1">drawPolygon</a></b>(const QPolygonF &amp;<i>points</i>, Qt::FillRule <i>fillRule</i> = Qt::OddEvenFill)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolygon-2">drawPolygon</a></b>(const QPoint *<i>points</i>, int <i>pointCount</i>, Qt::FillRule <i>fillRule</i> = Qt::OddEvenFill)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolygon-3">drawPolygon</a></b>(const QPolygon &amp;<i>points</i>, Qt::FillRule <i>fillRule</i> = Qt::OddEvenFill)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolyline">drawPolyline</a></b>(const QPointF *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolyline-1">drawPolyline</a></b>(const QPolygonF &amp;<i>points</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolyline-2">drawPolyline</a></b>(const QPoint *<i>points</i>, int <i>pointCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawPolyline-3">drawPolyline</a></b>(const QPolygon &amp;<i>points</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRect">drawRect</a></b>(const QRectF &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRect-1">drawRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRect-2">drawRect</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRects">drawRects</a></b>(const QRectF *<i>rectangles</i>, int <i>rectCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRects-1">drawRects</a></b>(const QVector&lt;QRectF&gt; &amp;<i>rectangles</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRects-2">drawRects</a></b>(const QRect *<i>rectangles</i>, int <i>rectCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRects-3">drawRects</a></b>(const QVector&lt;QRect&gt; &amp;<i>rectangles</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRoundedRect">drawRoundedRect</a></b>(const QRectF &amp;<i>rect</i>, qreal <i>xRadius</i>, qreal <i>yRadius</i>, Qt::SizeMode <i>mode</i> = Qt::AbsoluteSize)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRoundedRect-1">drawRoundedRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, qreal <i>xRadius</i>, qreal <i>yRadius</i>, Qt::SizeMode <i>mode</i> = ...)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawRoundedRect-2">drawRoundedRect</a></b>(const QRect &amp;<i>rect</i>, qreal <i>xRadius</i>, qreal <i>yRadius</i>, Qt::SizeMode <i>mode</i> = ...)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawStaticText">drawStaticText</a></b>(const QPointF &amp;<i>topLeftPosition</i>, const QStaticText &amp;<i>staticText</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawStaticText-1">drawStaticText</a></b>(const QPoint &amp;<i>topLeftPosition</i>, const QStaticText &amp;<i>staticText</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawStaticText-2">drawStaticText</a></b>(int <i>left</i>, int <i>top</i>, const QStaticText &amp;<i>staticText</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText">drawText</a></b>(const QRectF &amp;<i>rectangle</i>, int <i>flags</i>, const QString &amp;<i>text</i>, QRectF *<i>boundingRect</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText">drawText</a></b>(const QPointF &amp;<i>position</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText-1">drawText</a></b>(const QPoint &amp;<i>position</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText-2">drawText</a></b>(int <i>x</i>, int <i>y</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText-3">drawText</a></b>(const QRect &amp;<i>rectangle</i>, int <i>flags</i>, const QString &amp;<i>text</i>, QRect *<i>boundingRect</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText-4">drawText</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>flags</i>, const QString &amp;<i>text</i>, QRect *<i>boundingRect</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawText-5">drawText</a></b>(const QRectF &amp;<i>rectangle</i>, const QString &amp;<i>text</i>, const QTextOption &amp;<i>option</i> = QTextOption())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a></b>(const QRectF &amp;<i>rectangle</i>, const QPixmap &amp;<i>pixmap</i>, const QPointF &amp;<i>position</i> = QPointF())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawTiledPixmap-1">drawTiledPixmap</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, const QPixmap &amp;<i>pixmap</i>, int <i>sx</i> = 0, int <i>sy</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#drawTiledPixmap-2">drawTiledPixmap</a></b>(const QRect &amp;<i>rectangle</i>, const QPixmap &amp;<i>pixmap</i>, const QPoint &amp;<i>position</i> = ...)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#end">end</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#endNativePainting">endNativePainting</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#eraseRect">eraseRect</a></b>(const QRectF &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#eraseRect-1">eraseRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#eraseRect-2">eraseRect</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillPath">fillPath</a></b>(const QPainterPath &amp;<i>path</i>, const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect">fillRect</a></b>(const QRectF &amp;<i>rectangle</i>, const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-1">fillRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-2">fillRect</a></b>(const QRect &amp;<i>rectangle</i>, const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-3">fillRect</a></b>(const QRectF &amp;<i>rectangle</i>, const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-4">fillRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-5">fillRect</a></b>(const QRect &amp;<i>rectangle</i>, const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-6">fillRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, Qt::GlobalColor <i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-7">fillRect</a></b>(const QRect &amp;<i>rectangle</i>, Qt::GlobalColor <i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-8">fillRect</a></b>(const QRectF &amp;<i>rectangle</i>, Qt::GlobalColor <i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-9">fillRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, Qt::BrushStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-10">fillRect</a></b>(const QRect &amp;<i>rectangle</i>, Qt::BrushStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-11">fillRect</a></b>(const QRectF &amp;<i>rectangle</i>, Qt::BrushStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-12">fillRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, QGradient::Preset <i>preset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-13">fillRect</a></b>(const QRect &amp;<i>rectangle</i>, QGradient::Preset <i>preset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fillRect-14">fillRect</a></b>(const QRectF &amp;<i>rectangle</i>, QGradient::Preset <i>preset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QFont &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#font">font</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFontInfo </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fontInfo">fontInfo</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFontMetrics </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#fontMetrics">fontMetrics</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#hasClipping">hasClipping</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#isActive">isActive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::LayoutDirection </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#layoutDirection">layoutDirection</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#opacity">opacity</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPaintEngine *</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#paintEngine">paintEngine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPen &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#pen">pen</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainter::RenderHints </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#renderHints">renderHints</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#resetTransform">resetTransform</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#restore">restore</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#rotate">rotate</a></b>(qreal <i>angle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#save">save</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#scale">scale</a></b>(qreal <i>sx</i>, qreal <i>sy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBackground">setBackground</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBackgroundMode">setBackgroundMode</a></b>(Qt::BGMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBrush">setBrush</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBrush-1">setBrush</a></b>(Qt::BrushStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBrushOrigin">setBrushOrigin</a></b>(const QPointF &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBrushOrigin-1">setBrushOrigin</a></b>(int <i>x</i>, int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setBrushOrigin-2">setBrushOrigin</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipPath">setClipPath</a></b>(const QPainterPath &amp;<i>path</i>, Qt::ClipOperation <i>operation</i> = Qt::ReplaceClip)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipRect">setClipRect</a></b>(const QRectF &amp;<i>rectangle</i>, Qt::ClipOperation <i>operation</i> = Qt::ReplaceClip)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipRect-1">setClipRect</a></b>(const QRect &amp;<i>rectangle</i>, Qt::ClipOperation <i>operation</i> = Qt::ReplaceClip)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipRect-2">setClipRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, Qt::ClipOperation <i>operation</i> = Qt::ReplaceClip)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipRegion">setClipRegion</a></b>(const QRegion &amp;<i>region</i>, Qt::ClipOperation <i>operation</i> = Qt::ReplaceClip)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setClipping">setClipping</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setCompositionMode">setCompositionMode</a></b>(QPainter::CompositionMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setFont">setFont</a></b>(const QFont &amp;<i>font</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setLayoutDirection">setLayoutDirection</a></b>(Qt::LayoutDirection <i>direction</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setOpacity">setOpacity</a></b>(qreal <i>opacity</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setPen">setPen</a></b>(const QPen &amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setPen-1">setPen</a></b>(const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setPen-2">setPen</a></b>(Qt::PenStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setRenderHint">setRenderHint</a></b>(QPainter::RenderHint <i>hint</i>, bool <i>on</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setRenderHints">setRenderHints</a></b>(QPainter::RenderHints <i>hints</i>, bool <i>on</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setTransform">setTransform</a></b>(const QTransform &amp;<i>transform</i>, bool <i>combine</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setViewport">setViewport</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setViewport-1">setViewport</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setWindow">setWindow</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setWindow-1">setWindow</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#setWorldTransform">setWorldTransform</a></b>(const QTransform &amp;<i>matrix</i>, bool <i>combine</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#shear">shear</a></b>(qreal <i>sh</i>, qreal <i>sv</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#strokePath">strokePath</a></b>(const QPainterPath &amp;<i>path</i>, const QPen &amp;<i>pen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#testRenderHint">testRenderHint</a></b>(QPainter::RenderHint <i>hint</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#transform">transform</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#translate">translate</a></b>(const QPointF &amp;<i>offset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#translate-1">translate</a></b>(const QPoint &amp;<i>offset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#translate-2">translate</a></b>(qreal <i>dx</i>, qreal <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#viewport">viewport</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#window">window</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qpainter.html#worldTransform">worldTransform</a></b>() const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QPainter-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>QPainter provides highly optimized functions to do most of the drawing GUI programs require. It can draw everything from simple lines to complex shapes like pies and chords. It can also draw aligned text and pixmaps. Normally, it draws in a &quot;natural&quot; coordinate system, but it can also do view and world transformation. QPainter can operate on any object that inherits the <a href="qpaintdevice.html">QPaintDevice</a> class.</p>
<p>The common use of QPainter is inside a widget's paint event: Construct and customize (e.g&#x2e; set the pen or the brush) the painter. Then draw. Remember to destroy the QPainter object after drawing. For example:</p>
<pre class="cpp">

  <span class="type">void</span> SimpleExampleWidget<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
      painter<span class="operator">.</span>setPen(<span class="type">Qt</span><span class="operator">::</span>blue);
      painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Arial&quot;</span><span class="operator">,</span> <span class="number">30</span>));
      painter<span class="operator">.</span>drawText(rect()<span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>AlignCenter<span class="operator">,</span> <span class="string">&quot;Qt&quot;</span>);
  }

</pre>
<p>The core functionality of QPainter is drawing, but the class also provide several functions that allows you to customize QPainter's settings and its rendering quality, and others that enable clipping. In addition you can control how different shapes are merged together by specifying the painter's composition mode.</p>
<p>The <a href="qpainter.html#isActive">isActive</a>() function indicates whether the painter is active. A painter is activated by the <a href="qpainter.html#begin">begin</a>() function and the constructor that takes a <a href="qpaintdevice.html">QPaintDevice</a> argument. The <a href="qpainter.html#end">end</a>() function, and the destructor, deactivates it.</p>
<p>Together with the <a href="qpaintdevice.html">QPaintDevice</a> and <a href="qpaintengine.html">QPaintEngine</a> classes, QPainter form the basis for Qt's paint system. QPainter is the class used to perform drawing operations. <a href="qpaintdevice.html">QPaintDevice</a> represents a device that can be painted on using a QPainter. <a href="qpaintengine.html">QPaintEngine</a> provides the interface that the painter uses to draw onto different types of devices. If the painter is active, <a href="qpainter.html#device">device</a>() returns the paint device on which the painter paints, and <a href="qpainter.html#paintEngine">paintEngine</a>() returns the paint engine that the painter is currently operating on. For more information, see the <a href="paintsystem.html">Paint System</a>.</p>
<p>Sometimes it is desirable to make someone else paint on an unusual <a href="qpaintdevice.html">QPaintDevice</a>. QPainter supports a static function to do this, setRedirected().</p>
<p><b>Warning:</b> When the paintdevice is a widget, QPainter can only be used inside a paintEvent() function or in a function called by paintEvent().</p>
<a name="settings"></a>
<h3 id="settings">Settings</h3>
<p>There are several settings that you can customize to make QPainter draw according to your preferences:</p>
<ul>
<li><a href="qpainter.html#font">font</a>() is the font used for drawing text. If the painter <a href="qpainter.html#isActive">isActive</a>(), you can retrieve information about the currently set font, and its metrics, using the <a href="qpainter.html#fontInfo">fontInfo</a>() and <a href="qpainter.html#fontMetrics">fontMetrics</a>() functions respectively.</li>
<li><a href="qpainter.html#brush">brush</a>() defines the color or pattern that is used for filling shapes.</li>
<li><a href="qpainter.html#pen">pen</a>() defines the color or stipple that is used for drawing lines or boundaries.</li>
<li><a href="qpainter.html#backgroundMode">backgroundMode</a>() defines whether there is a <a href="qpainter.html#background">background</a>() or not, i.e it is either <a href="../qtcore/qt.html#BGMode-enum">Qt::OpaqueMode</a> or <a href="../qtcore/qt.html#BGMode-enum">Qt::TransparentMode</a>.</li>
<li><a href="qpainter.html#background">background</a>() only applies when <a href="qpainter.html#backgroundMode">backgroundMode</a>() is <a href="../qtcore/qt.html#BGMode-enum">Qt::OpaqueMode</a> and <a href="qpainter.html#pen">pen</a>() is a stipple. In that case, it describes the color of the background pixels in the stipple.</li>
<li><a href="qpainter.html#brushOrigin">brushOrigin</a>() defines the origin of the tiled brushes, normally the origin of widget's background.</li>
<li><a href="qpainter.html#viewport">viewport</a>(), <a href="qpainter.html#window">window</a>(), <a href="qpainter.html#worldTransform">worldTransform</a>() make up the painter's coordinate transformation system. For more information, see the <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a> section and the <a href="coordsys.html">Coordinate System</a> documentation.</li>
<li><a href="qpainter.html#hasClipping">hasClipping</a>() tells whether the painter clips at all. (The paint device clips, too.) If the painter clips, it clips to <a href="qpainter.html#clipRegion">clipRegion</a>().</li>
<li><a href="qpainter.html#layoutDirection">layoutDirection</a>() defines the layout direction used by the painter when drawing text.</li>
<li><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>() tells whether world transformation is enabled.</li>
<li><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>() tells whether view transformation is enabled.</li>
</ul>
<p>Note that some of these settings mirror settings in some paint devices, e.g&#x2e; <a href="../qtwidgets/qwidget.html#font-prop">QWidget::font</a>(). The <a href="qpainter.html#begin">QPainter::begin</a>() function (or equivalently the QPainter constructor) copies these attributes from the paint device.</p>
<p>You can at any time save the QPainter's state by calling the <a href="qpainter.html#save">save</a>() function which saves all the available settings on an internal stack. The <a href="qpainter.html#restore">restore</a>() function pops them back.</p>
<a name="drawing"></a>
<h3 id="drawing">Drawing</h3>
<p>QPainter provides functions to draw most primitives: <a href="qpainter.html#drawPoint">drawPoint</a>(), <a href="qpainter.html#drawPoints">drawPoints</a>(), <a href="qpainter.html#drawLine">drawLine</a>(), <a href="qpainter.html#drawRect">drawRect</a>(), <a href="qpainter.html#drawRoundedRect">drawRoundedRect</a>(), <a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawArc">drawArc</a>(), <a href="qpainter.html#drawPie">drawPie</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>() and drawCubicBezier(). The two convenience functions, <a href="qpainter.html#drawRects">drawRects</a>() and <a href="qpainter.html#drawLines">drawLines</a>(), draw the given number of rectangles or lines in the given array of <a href="../qtcore/qrect.html">QRects</a> or <a href="../qtcore/qline.html">QLines</a> using the current pen and brush.</p>
<p>The QPainter class also provides the <a href="qpainter.html#fillRect">fillRect</a>() function which fills the given <a href="../qtcore/qrect.html">QRect</a>, with the given <a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#eraseRect">eraseRect</a>() function that erases the area inside the given rectangle.</p>
<p>All of these functions have both integer and floating point versions.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-basicdrawing.png" alt="" /></td><td ><b>Basic Drawing Example</b><p>The <a href="../qtwidgets/qtwidgets-painting-basicdrawing-example.html">Basic Drawing</a> example shows how to display basic graphics primitives in a variety of styles using the QPainter class.</p>
</td></tr>
</table></div>
<p>If you need to draw a complex shape, especially if you need to do so repeatedly, consider creating a <a href="qpainterpath.html">QPainterPath</a> and drawing it using <a href="qpainter.html#drawPath">drawPath</a>().</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><b>Painter Paths example</b><p>The <a href="qpainterpath.html">QPainterPath</a> class provides a container for painting operations, enabling graphical shapes to be constructed and reused.</p>
<p>The <a href="../qtwidgets/qtwidgets-painting-painterpaths-example.html">Painter Paths</a> example shows how painter paths can be used to build complex shapes for rendering.</p>
</td><td ><img src="images/qpainter-painterpaths.png" alt="" /></td></tr>
</table></div>
<p>QPainter also provides the <a href="qpainter.html#fillPath">fillPath</a>() function which fills the given <a href="qpainterpath.html">QPainterPath</a> with the given <a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#strokePath">strokePath</a>() function that draws the outline of the given path (i.e&#x2e; strokes the path).</p>
<p>See also the <a href="../qtwidgets/qtwidgets-painting-deform-example.html">Vector Deformation</a> example which shows how to use advanced vector techniques to draw text using a <a href="qpainterpath.html">QPainterPath</a>, the <a href="../qtwidgets/qtwidgets-painting-gradients-example.html">Gradients</a> example which shows the different types of gradients that are available in Qt, and the <a href="../qtwidgets/qtwidgets-painting-pathstroke-example.html">Path Stroking</a> example which shows Qt's built-in dash patterns and shows how custom patterns can be used to extend the range of available patterns.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th ><a href="../qtwidgets/qtwidgets-painting-deform-example.html">Vector Deformation</a></th><th ><a href="../qtwidgets/qtwidgets-painting-gradients-example.html">Gradients</a></th><th ><a href="../qtwidgets/qtwidgets-painting-pathstroke-example.html">Path Stroking</a></th></tr></thead>
<tr valign="top" class="odd"><td ><img src="images/qpainter-vectordeformation.png" alt="" /></td><td ><img src="images/qpainter-gradients.png" alt="" /></td><td ><img src="images/qpainter-pathstroking.png" alt="" /></td></tr>
</table></div>
<p>Text drawing is done using <a href="qpainter.html#drawText">drawText</a>(). When you need fine-grained positioning, <a href="qpainter.html#boundingRect">boundingRect</a>() tells you where a given <a href="qpainter.html#drawText">drawText</a>() command will draw.</p>
<a name="drawing-pixmaps-and-images"></a>
<h3 id="drawing-pixmaps-and-images">Drawing Pixmaps and Images</h3>
<p>There are functions to draw pixmaps/images, namely <a href="qpainter.html#drawPixmap">drawPixmap</a>(), <a href="qpainter.html#drawImage">drawImage</a>() and <a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a>(). Both <a href="qpainter.html#drawPixmap">drawPixmap</a>() and <a href="qpainter.html#drawImage">drawImage</a>() produce the same result, except that <a href="qpainter.html#drawPixmap">drawPixmap</a>() is faster on-screen while <a href="qpainter.html#drawImage">drawImage</a>() may be faster on a QPrinter or other devices.</p>
<p>There is a <a href="qpainter.html#drawPicture">drawPicture</a>() function that draws the contents of an entire <a href="qpicture.html">QPicture</a>. The <a href="qpainter.html#drawPicture">drawPicture</a>() function is the only function that disregards all the painter's settings as <a href="qpicture.html">QPicture</a> has its own settings.</p>
<a name="drawing-high-resolution-versions-of-pixmaps-and-images"></a>
<h4 id="drawing-high-resolution-versions-of-pixmaps-and-images">Drawing High Resolution Versions of Pixmaps and Images</h4>
<p>High resolution versions of pixmaps have a <i>device pixel ratio</i> value larger than 1 (see <a href="qimagereader.html">QImageReader</a>, <a href="qpixmap.html#devicePixelRatio">QPixmap::devicePixelRatio</a>()). Should it match the value of the underlying <a href="qpaintdevice.html">QPaintDevice</a>, it is drawn directly onto the device with no additional transformation applied.</p>
<p>This is for example the case when drawing a <a href="qpixmap.html">QPixmap</a> of 64x64 pixels size with a device pixel ratio of 2 onto a high DPI screen which also has a device pixel ratio of 2. Note that the pixmap is then effectively 32x32 pixels in <i>user space</i>. Code paths in Qt that calculate layout geometry based on the pixmap size will use this size. The net effect of this is that the pixmap is displayed as high DPI pixmap rather than a large pixmap.</p>
<a name="rendering-quality"></a>
<h3 id="rendering-quality">Rendering Quality</h3>
<p>To get the optimal rendering result using QPainter, you should use the platform independent <a href="qimage.html">QImage</a> as paint device; i.e&#x2e; using <a href="qimage.html">QImage</a> will ensure that the result has an identical pixel representation on any platform.</p>
<p>The QPainter class also provides a means of controlling the rendering quality through its <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum and the support for floating point precision: All the functions for drawing primitives has a floating point version. These are often used in combination with the <a href="qpainter.html#RenderHint-enum">QPainter::Antialiasing</a> render hint.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-concentriccircles.png" alt="" /></td><td ><b>Concentric Circles Example</b><p>The <a href="../qtwidgets/qtwidgets-painting-concentriccircles-example.html">Concentric Circles</a> example shows the improved rendering quality that can be obtained using floating point precision and anti-aliasing when drawing custom widgets.</p>
<p>The application's main window displays several widgets which are drawn using the various combinations of precision and anti-aliasing.</p>
</td></tr>
</table></div>
<p>The <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum specifies flags to QPainter that may or may not be respected by any given engine. <a href="qpainter.html#RenderHint-enum">QPainter::Antialiasing</a> indicates that the engine should antialias edges of primitives if possible, <a href="qpainter.html#RenderHint-enum">QPainter::TextAntialiasing</a> indicates that the engine should antialias text if possible, and the <a href="qpainter.html#RenderHint-enum">QPainter::SmoothPixmapTransform</a> indicates that the engine should use a smooth pixmap transformation algorithm.</p>
<p>The <a href="qpainter.html#renderHints">renderHints</a>() function returns a flag that specifies the rendering hints that are set for this painter. Use the <a href="qpainter.html#setRenderHint">setRenderHint</a>() function to set or clear the currently set <a href="qpainter.html#RenderHint-enum">RenderHints</a>.</p>
<a name="coordinate-transformations"></a>
<h3 id="coordinate-transformations">Coordinate Transformations</h3>
<p>Normally, the QPainter operates on the device's own coordinate system (usually pixels), but QPainter has good support for coordinate transformations.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >nop</th><th ><a href="qpainter.html#rotate">rotate</a>()</th><th ><a href="qpainter.html#scale">scale</a>()</th><th ><a href="qpainter.html#translate">translate</a>()</th></tr></thead>
<tr valign="top" class="odd"><td ><img src="images/qpainter-clock.png" alt="" /></td><td ><img src="images/qpainter-rotation.png" alt="" /></td><td ><img src="images/qpainter-scale.png" alt="" /></td><td ><img src="images/qpainter-translation.png" alt="" /></td></tr>
</table></div>
<p>The most commonly used transformations are scaling, rotation, translation and shearing. Use the <a href="qpainter.html#scale">scale</a>() function to scale the coordinate system by a given offset, the <a href="qpainter.html#rotate">rotate</a>() function to rotate it clockwise and <a href="qpainter.html#translate">translate</a>() to translate it (i.e&#x2e; adding a given offset to the points). You can also twist the coordinate system around the origin using the <a href="qpainter.html#shear">shear</a>() function. See the <a href="../qtwidgets/qtwidgets-painting-affine-example.html">Affine Transformations</a> example for a visualization of a sheared coordinate system.</p>
<p>See also the <a href="../qtwidgets/qtwidgets-painting-transformations-example.html">Transformations</a> example which shows how transformations influence the way that QPainter renders graphics primitives. In particular it shows how the order of transformations affects the result.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><b>Affine Transformations Example</b><p>The <a href="../qtwidgets/qtwidgets-painting-affine-example.html">Affine Transformations</a> example shows Qt's ability to perform affine transformations on painting operations. The demo also allows the user to experiment with the transformation operations and see the results immediately.</p>
</td><td ><img src="images/qpainter-affinetransformations.png" alt="" /></td></tr>
</table></div>
<p>All the tranformation operations operate on the transformation <a href="qpainter.html#worldTransform">worldTransform</a>(). A matrix transforms a point in the plane to another point. For more information about the transformation matrix, see the <a href="coordsys.html">Coordinate System</a> and <a href="qtransform.html">QTransform</a> documentation.</p>
<p>The <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() function can replace or add to the currently set <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#resetTransform">resetTransform</a>() function resets any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>() functions. The <a href="qpainter.html#deviceTransform">deviceTransform</a>() returns the matrix that transforms from logical coordinates to device coordinates of the platform dependent paint device. The latter function is only needed when using platform painting commands on the platform dependent handle, and the platform does not do transformations nativly.</p>
<p>When drawing with QPainter, we specify points using logical coordinates which then are converted into the physical coordinates of the paint device. The mapping of the logical coordinates to the physical coordinates are handled by QPainter's <a href="qpainter.html#combinedTransform">combinedTransform</a>(), a combination of <a href="qpainter.html#viewport">viewport</a>() and <a href="qpainter.html#window">window</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#viewport">viewport</a>() represents the physical coordinates specifying an arbitrary rectangle, the <a href="qpainter.html#window">window</a>() describes the same rectangle in logical coordinates, and the <a href="qpainter.html#worldTransform">worldTransform</a>() is identical with the transformation matrix.</p>
<p>See also <a href="coordsys.html">Coordinate System</a></p>
<a name="clipping"></a>
<h3 id="clipping">Clipping</h3>
<p>QPainter can clip any drawing operation to a rectangle, a region, or a vector path. The current clip is available using the functions <a href="qpainter.html#clipRegion">clipRegion</a>() and <a href="qpainter.html#clipPath">clipPath</a>(). Whether paths or regions are preferred (faster) depends on the underlying <a href="qpainter.html#paintEngine">paintEngine</a>(). For example, the <a href="qimage.html">QImage</a> paint engine prefers paths while the X11 paint engine prefers regions. Setting a clip is done in the painters logical coordinates.</p>
<p>After QPainter's clipping, the paint device may also clip. For example, most widgets clip away the pixels used by child widgets, and most printers clip away an area near the edges of the paper. This additional clipping is not reflected by the return value of <a href="qpainter.html#clipRegion">clipRegion</a>() or <a href="qpainter.html#hasClipping">hasClipping</a>().</p>
<a name="composition-modes"></a>
<h3 id="composition-modes">Composition Modes</h3>
<a name="composition-modes"></a><p>QPainter provides the <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> enum which defines the Porter-Duff rules for digital image compositing; it describes a model for combining the pixels in one image, the source, with the pixels in another image, the destination.</p>
<p>The two most common forms of composition are <a href="qpainter.html#CompositionMode-enum">Source</a> and <a href="qpainter.html#CompositionMode-enum">SourceOver</a>. <a href="qpainter.html#CompositionMode-enum">Source</a> is used to draw opaque objects onto a paint device. In this mode, each pixel in the source replaces the corresponding pixel in the destination. In <a href="qpainter.html#CompositionMode-enum">SourceOver</a> composition mode, the source object is transparent and is drawn on top of the destination.</p>
<p>Note that composition transformation operates pixelwise. For that reason, there is a difference between using the graphic primitive itself and its bounding rectangle: The bounding rect contains pixels with alpha == 0 (i.e the pixels surrounding the primitive). These pixels will overwrite the other image's pixels, effectively clearing those, while the primitive only overwrites its own area.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-compositiondemo.png" alt="" /></td><td ><b>Composition Modes Example</b><p>The <a href="../qtwidgets/qtwidgets-painting-composition-example.html">Composition Modes</a> example, available in Qt's examples directory, allows you to experiment with the various composition modes and see the results immediately.</p>
</td></tr>
</table></div>
<a name="limitations"></a>
<h3 id="limitations">Limitations</h3>
<a name="limitations"></a><p>If you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2<sup>15</sup> can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of <code>short int</code> in the implementation.</p>
<p>The outlines generated by Qt's stroker are only an approximation when dealing with curved shapes. It is in most cases impossible to represent the outline of a bezier curve segment using another bezier curve segment, and so Qt approximates the curve outlines by using several smaller curves. For performance reasons there is a limit to how many curves Qt uses for these outlines, and thus when using large pen widths or scales the outline error increases. To generate outlines with smaller errors it is possible to use the <a href="qpainterpathstroker.html">QPainterPathStroker</a> class, which has the setCurveThreshold member function which let's the user specify the error tolerance. Another workaround is to convert the paths to polygons first and then draw the polygons instead.</p>
<a name="performance"></a>
<h3 id="performance">Performance</h3>
<p>QPainter is a rich framework that allows developers to do a great variety of graphical operations, such as gradients, composition modes and vector graphics. And QPainter can do this across a variety of different hardware and software stacks. Naturally the underlying combination of hardware and software has some implications for performance, and ensuring that every single operation is fast in combination with all the various combinations of composition modes, brushes, clipping, transformation, etc, is close to an impossible task because of the number of permutations. As a compromise we have selected a subset of the QPainter API and backends, where performance is guaranteed to be as good as we can sensibly get it for the given combination of hardware and software.</p>
<p>The backends we focus on as high-performance engines are:</p>
<ul>
<li>Raster - This backend implements all rendering in pure software and is always used to render into QImages. For optimal performance only use the format types <a href="qimage.html#Format-enum">QImage::Format_ARGB32_Premultiplied</a>, <a href="qimage.html#Format-enum">QImage::Format_RGB32</a> or <a href="qimage.html#Format-enum">QImage::Format_RGB16</a>. Any other format, including <a href="qimage.html#Format-enum">QImage::Format_ARGB32</a>, has significantly worse performance. This engine is used by default for <a href="../qtwidgets/qwidget.html">QWidget</a> and <a href="qpixmap.html">QPixmap</a>.</li>
<li>OpenGL 2.0 (ES) - This backend is the primary backend for hardware accelerated graphics. It can be run on desktop machines and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 specification. This includes most graphics chips produced in the last couple of years. The engine can be enabled by using QPainter onto a <a href="../qtwidgets/qopenglwidget.html">QOpenGLWidget</a>.</li>
</ul>
<p>These operations are:</p>
<ul>
<li>Simple transformations, meaning translation and scaling, pluss 0, 90, 180, 270 degree rotations.</li>
<li><code>drawPixmap()</code> in combination with simple transformations and opacity with non-smooth transformation mode (<code>QPainter::SmoothPixmapTransform</code> not enabled as a render hint).</li>
<li>Rectangle fills with solid color, two-color linear gradients and simple transforms.</li>
<li>Rectangular clipping with simple transformations and intersect clip.</li>
<li>Composition Modes <code>QPainter::CompositionMode_Source</code> and <a href="qpainter.html#CompositionMode-enum">QPainter::CompositionMode_SourceOver</a>.</li>
<li>Rounded rectangle filling using solid color and two-color linear gradients fills.</li>
<li>3x3 patched pixmaps, via qDrawBorderPixmap.</li>
</ul>
<p>This list gives an indication of which features to safely use in an application where performance is critical. For certain setups, other operations may be fast too, but before making extensive use of them, it is recommended to benchmark and verify them on the system where the software will run in the end. There are also cases where expensive operations are ok to use, for instance when the result is cached in a <a href="qpixmap.html">QPixmap</a>.</p>
</div>
<p><b>See also </b><a href="qpaintdevice.html">QPaintDevice</a>, <a href="qpaintengine.html">QPaintEngine</a>, <a href="../qtsvg/qtsvg-index.html">Qt SVG</a>, <a href="../qtwidgets/qtwidgets-painting-basicdrawing-example.html">Basic Drawing Example</a>, and <a href="../qtwidgets/qdrawutil-h.html">Drawing Utility Functions</a>.</p>
<!-- @@@QPainter -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CompositionMode$$$CompositionMode_SourceOver$$$CompositionMode_DestinationOver$$$CompositionMode_Clear$$$CompositionMode_Source$$$CompositionMode_Destination$$$CompositionMode_SourceIn$$$CompositionMode_DestinationIn$$$CompositionMode_SourceOut$$$CompositionMode_DestinationOut$$$CompositionMode_SourceAtop$$$CompositionMode_DestinationAtop$$$CompositionMode_Xor$$$CompositionMode_Plus$$$CompositionMode_Multiply$$$CompositionMode_Screen$$$CompositionMode_Overlay$$$CompositionMode_Darken$$$CompositionMode_Lighten$$$CompositionMode_ColorDodge$$$CompositionMode_ColorBurn$$$CompositionMode_HardLight$$$CompositionMode_SoftLight$$$CompositionMode_Difference$$$CompositionMode_Exclusion$$$RasterOp_SourceOrDestination$$$RasterOp_SourceAndDestination$$$RasterOp_SourceXorDestination$$$RasterOp_NotSourceAndNotDestination$$$RasterOp_NotSourceOrNotDestination$$$RasterOp_NotSourceXorDestination$$$RasterOp_NotSource$$$RasterOp_NotSourceAndDestination$$$RasterOp_SourceAndNotDestination$$$RasterOp_NotSourceOrDestination$$$RasterOp_SourceOrNotDestination$$$RasterOp_ClearDestination$$$RasterOp_SetDestination$$$RasterOp_NotDestination -->
<h3 class="fn" id="CompositionMode-enum"><a name="CompositionMode-enum"></a>enum QPainter::<span class="name">CompositionMode</span></h3>
<p>Defines the modes supported for digital image compositing. Composition modes are used to specify how the pixels in one image, the source, are merged with the pixel in another image, the destination.</p>
<p>Please note that the bitwise raster operation modes, denoted with a RasterOp prefix, are only natively supported in the X11 and raster paint engines. This means that the only way to utilize these modes on the Mac is via a <a href="qimage.html">QImage</a>. The RasterOp denoted blend modes are <i>not</i> supported for pens and brushes with alpha components. Also, turning on the <a href="qpainter.html#RenderHint-enum">QPainter::Antialiasing</a> render hint will effectively disable the RasterOp modes.</p>
<p class="centerAlign"><img src="images/qpainter-compositionmode1.png" alt="" /></p><p class="centerAlign"><img src="images/qpainter-compositionmode2.png" alt="" /></p><p>The most common type is SourceOver (often referred to as just alpha blending) where the source pixel is blended on top of the destination pixel in such a way that the alpha component of the source defines the translucency of the pixel.</p>
<p>Several composition modes require an alpha channel in the source or target images to have an effect. For optimal performance the image format <a href="qimage.html#Format-enum">Format_ARGB32_Premultiplied</a> is preferred.</p>
<p>When a composition mode is set it applies to all painting operator, pens, brushes, gradients and pixmap/image drawing.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_SourceOver</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">This is the default mode. The alpha of the source is used to blend the pixel on top of the destination.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_DestinationOver</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The alpha of the destination is used to blend it on top of the source pixels. This mode is the inverse of CompositionMode_SourceOver.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Clear</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The pixels in the destination are cleared (set to fully transparent) independent of the source.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Source</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The output is the source pixel. (This means a basic copy operation and is identical to SourceOver when the source pixel is opaque).</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Destination</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">The output is the destination pixel. This means that the blending has no effect. This mode is the inverse of CompositionMode_Source.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_SourceIn</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">The output is the source, where the alpha is reduced by that of the destination.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_DestinationIn</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">The output is the destination, where the alpha is reduced by that of the source. This mode is the inverse of CompositionMode_SourceIn.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_SourceOut</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">The output is the source, where the alpha is reduced by the inverse of destination.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_DestinationOut</code></td><td class="topAlign tblval"><code>8</code></td><td class="topAlign">The output is the destination, where the alpha is reduced by the inverse of the source. This mode is the inverse of CompositionMode_SourceOut.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_SourceAtop</code></td><td class="topAlign tblval"><code>9</code></td><td class="topAlign">The source pixel is blended on top of the destination, with the alpha of the source pixel reduced by the alpha of the destination pixel.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_DestinationAtop</code></td><td class="topAlign tblval"><code>10</code></td><td class="topAlign">The destination pixel is blended on top of the source, with the alpha of the destination pixel is reduced by the alpha of the destination pixel. This mode is the inverse of CompositionMode_SourceAtop.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Xor</code></td><td class="topAlign tblval"><code>11</code></td><td class="topAlign">The source, whose alpha is reduced with the inverse of the destination alpha, is merged with the destination, whose alpha is reduced by the inverse of the source alpha. CompositionMode_Xor is not the same as the bitwise Xor.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Plus</code></td><td class="topAlign tblval"><code>12</code></td><td class="topAlign">Both the alpha and color of the source and destination pixels are added together.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Multiply</code></td><td class="topAlign tblval"><code>13</code></td><td class="topAlign">The output is the source color multiplied by the destination. Multiplying a color with white leaves the color unchanged, while multiplying a color with black produces black.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Screen</code></td><td class="topAlign tblval"><code>14</code></td><td class="topAlign">The source and destination colors are inverted and then multiplied. Screening a color with white produces white, whereas screening a color with black leaves the color unchanged.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Overlay</code></td><td class="topAlign tblval"><code>15</code></td><td class="topAlign">Multiplies or screens the colors depending on the destination color. The destination color is mixed with the source color to reflect the lightness or darkness of the destination.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Darken</code></td><td class="topAlign tblval"><code>16</code></td><td class="topAlign">The darker of the source and destination colors is selected.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Lighten</code></td><td class="topAlign tblval"><code>17</code></td><td class="topAlign">The lighter of the source and destination colors is selected.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_ColorDodge</code></td><td class="topAlign tblval"><code>18</code></td><td class="topAlign">The destination color is brightened to reflect the source color. A black source color leaves the destination color unchanged.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_ColorBurn</code></td><td class="topAlign tblval"><code>19</code></td><td class="topAlign">The destination color is darkened to reflect the source color. A white source color leaves the destination color unchanged.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_HardLight</code></td><td class="topAlign tblval"><code>20</code></td><td class="topAlign">Multiplies or screens the colors depending on the source color. A light source color will lighten the destination color, whereas a dark source color will darken the destination color.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_SoftLight</code></td><td class="topAlign tblval"><code>21</code></td><td class="topAlign">Darkens or lightens the colors depending on the source color. Similar to CompositionMode_HardLight.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Difference</code></td><td class="topAlign tblval"><code>22</code></td><td class="topAlign">Subtracts the darker of the colors from the lighter. Painting with white inverts the destination color, whereas painting with black leaves the destination color unchanged.</td></tr>
<tr><td class="topAlign"><code>QPainter::CompositionMode_Exclusion</code></td><td class="topAlign tblval"><code>23</code></td><td class="topAlign">Similar to CompositionMode_Difference, but with a lower contrast. Painting with white inverts the destination color, whereas painting with black leaves the destination color unchanged.</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SourceOrDestination</code></td><td class="topAlign tblval"><code>24</code></td><td class="topAlign">Does a bitwise OR operation on the source and destination pixels (src OR dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SourceAndDestination</code></td><td class="topAlign tblval"><code>25</code></td><td class="topAlign">Does a bitwise AND operation on the source and destination pixels (src AND dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SourceXorDestination</code></td><td class="topAlign tblval"><code>26</code></td><td class="topAlign">Does a bitwise XOR operation on the source and destination pixels (src XOR dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSourceAndNotDestination</code></td><td class="topAlign tblval"><code>27</code></td><td class="topAlign">Does a bitwise NOR operation on the source and destination pixels ((NOT src) AND (NOT dst)).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSourceOrNotDestination</code></td><td class="topAlign tblval"><code>28</code></td><td class="topAlign">Does a bitwise NAND operation on the source and destination pixels ((NOT src) OR (NOT dst)).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSourceXorDestination</code></td><td class="topAlign tblval"><code>29</code></td><td class="topAlign">Does a bitwise operation where the source pixels are inverted and then XOR'ed with the destination ((NOT src) XOR dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSource</code></td><td class="topAlign tblval"><code>30</code></td><td class="topAlign">Does a bitwise operation where the source pixels are inverted (NOT src).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSourceAndDestination</code></td><td class="topAlign tblval"><code>31</code></td><td class="topAlign">Does a bitwise operation where the source is inverted and then AND'ed with the destination ((NOT src) AND dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SourceAndNotDestination</code></td><td class="topAlign tblval"><code>32</code></td><td class="topAlign">Does a bitwise operation where the source is AND'ed with the inverted destination pixels (src AND (NOT dst)).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotSourceOrDestination</code></td><td class="topAlign tblval"><code>33</code></td><td class="topAlign">Does a bitwise operation where the source is inverted and then OR'ed with the destination ((NOT src) OR dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_ClearDestination</code></td><td class="topAlign tblval"><code>35</code></td><td class="topAlign">The pixels in the destination are cleared (set to 0) independent of the source.</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SetDestination</code></td><td class="topAlign tblval"><code>36</code></td><td class="topAlign">The pixels in the destination are set (set to 1) independent of the source.</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_NotDestination</code></td><td class="topAlign tblval"><code>37</code></td><td class="topAlign">Does a bitwise operation where the destination pixels are inverted (NOT dst).</td></tr>
<tr><td class="topAlign"><code>QPainter::RasterOp_SourceOrNotDestination</code></td><td class="topAlign tblval"><code>34</code></td><td class="topAlign">Does a bitwise operation where the source is OR'ed with the inverted destination pixels (src OR (NOT dst)).</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#compositionMode">compositionMode</a>(), <a href="qpainter.html#setCompositionMode">setCompositionMode</a>(), <a href="qpainter.html#composition-modes">Composition Modes</a>, and <a href="../qtwidgets/qtwidgets-painting-imagecomposition-example.html">Image Composition Example</a>.</p>
<!-- @@@CompositionMode -->
<!-- $$$PixmapFragmentHint$$$OpaqueHint -->
<h3 class="flags" id="PixmapFragmentHint-enum"><a name="PixmapFragmentHint-enum"></a>enum QPainter::<span class="name">PixmapFragmentHint</span><br/>flags QPainter::<span class="name">PixmapFragmentHints</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPainter::OpaqueHint</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">Indicates that the pixmap fragments to be drawn are opaque. Opaque fragments are potentially faster to draw.</td></tr>
</table></div>
<p>This enum was introduced or modified in Qt 4.7.</p>
<p>The PixmapFragmentHints type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;PixmapFragmentHint&gt;. It stores an OR combination of PixmapFragmentHint values.</p>
<p><b>See also </b><a href="qpainter.html#drawPixmapFragments">QPainter::drawPixmapFragments</a>() and <a href="qpainter-pixmapfragment.html">QPainter::PixmapFragment</a>.</p>
<!-- @@@PixmapFragmentHint -->
<!-- $$$RenderHint$$$Antialiasing$$$TextAntialiasing$$$SmoothPixmapTransform$$$HighQualityAntialiasing$$$NonCosmeticDefaultPen$$$Qt4CompatiblePainting$$$LosslessImageRendering -->
<h3 class="flags" id="RenderHint-enum"><a name="RenderHint-enum"></a>enum QPainter::<span class="name">RenderHint</span><br/>flags QPainter::<span class="name">RenderHints</span></h3>
<p>Renderhints are used to specify flags to <a href="qpainter.html">QPainter</a> that may or may not be respected by any given engine.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPainter::Antialiasing</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">Indicates that the engine should antialias edges of primitives if possible.</td></tr>
<tr><td class="topAlign"><code>QPainter::TextAntialiasing</code></td><td class="topAlign tblval"><code>0x02</code></td><td class="topAlign">Indicates that the engine should antialias text if possible. To forcibly disable antialiasing for text, do not use this hint. Instead, set <a href="qfont.html#StyleStrategy-enum">QFont::NoAntialias</a> on your font's style strategy.</td></tr>
<tr><td class="topAlign"><code>QPainter::SmoothPixmapTransform</code></td><td class="topAlign tblval"><code>0x04</code></td><td class="topAlign">Indicates that the engine should use a smooth pixmap transformation algorithm (such as bilinear) rather than nearest neighbor.</td></tr>
<tr><td class="topAlign"><code>QPainter::HighQualityAntialiasing</code></td><td class="topAlign tblval"><code>0x08</code></td><td class="topAlign">This value is obsolete and will be ignored, use the Antialiasing render hint instead.</td></tr>
<tr><td class="topAlign"><code>QPainter::NonCosmeticDefaultPen</code></td><td class="topAlign tblval"><code>0x10</code></td><td class="topAlign">This value is obsolete, the default for <a href="qpen.html">QPen</a> is now non-cosmetic.</td></tr>
<tr><td class="topAlign"><code>QPainter::Qt4CompatiblePainting</code></td><td class="topAlign tblval"><code>0x20</code></td><td class="topAlign">Compatibility hint telling the engine to use the same X11 based fill rules as in Qt 4, where aliased rendering is offset by slightly less than half a pixel. Also will treat default constructed pens as cosmetic. Potentially useful when porting a Qt 4 application to Qt 5.</td></tr>
<tr><td class="topAlign"><code>QPainter::LosslessImageRendering</code></td><td class="topAlign tblval"><code>0x40</code></td><td class="topAlign">Use a lossless image rendering, whenever possible. Currently, this hint is only used when <a href="qpainter.html">QPainter</a> is employed to output a PDF file through QPrinter or <a href="qpdfwriter.html">QPdfWriter</a>, where <a href="qpainter.html#drawImage">drawImage</a>()/<a href="qpainter.html#drawPixmap">drawPixmap</a>() calls will encode images using a lossless compression algorithm instead of lossy JPEG compression. This value was added in Qt 5.13.</td></tr>
</table></div>
<p>The RenderHints type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;RenderHint&gt;. It stores an OR combination of RenderHint values.</p>
<p><b>See also </b><a href="qpainter.html#renderHints">renderHints</a>(), <a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#rendering-quality">Rendering Quality</a>, and <a href="../qtwidgets/qtwidgets-painting-concentriccircles-example.html">Concentric Circles Example</a>.</p>
<!-- @@@RenderHint -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QPainter$$$QPainterQPaintDevice* -->
<h3 class="fn" id="QPainter-1"><a name="QPainter-1"></a>QPainter::<span class="name">QPainter</span>(<span class="type"><a href="qpaintdevice.html">QPaintDevice</a></span> *<i>device</i>)</h3>
<p>Constructs a painter that begins painting the paint <i>device</i> immediately.</p>
<p>This constructor is convenient for short-lived painters, e.g&#x2e; in a <a href="../qtwidgets/qwidget.html#paintEvent">QWidget::paintEvent</a>() and should be used only once. The constructor calls <a href="qpainter.html#begin">begin</a>() for you and the QPainter destructor automatically calls <a href="qpainter.html#end">end</a>().</p>
<p>Here's an example using <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>():</p>
<pre class="cpp">

  <span class="type">void</span> MyWidget<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> p;
      p<span class="operator">.</span>begin(<span class="keyword">this</span>);
      p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);        <span class="comment">// drawing code</span>
      p<span class="operator">.</span>end();
  }

</pre>
<p>The same example using this constructor:</p>
<pre class="cpp">

  <span class="type">void</span> MyWidget<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> p(<span class="keyword">this</span>);
      p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);        <span class="comment">// drawing code</span>
  }

</pre>
<p>Since the constructor cannot provide feedback when the initialization of the painter failed you should rather use <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>() to paint on external devices, e.g&#x2e; printers.</p>
<p><b>See also </b><a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>().</p>
<!-- @@@QPainter -->
<!-- $$$QPainter[overload1]$$$QPainter -->
<h3 class="fn" id="QPainter"><a name="QPainter"></a>QPainter::<span class="name">QPainter</span>()</h3>
<p>Constructs a painter.</p>
<p><b>See also </b><a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>().</p>
<!-- @@@QPainter -->
<!-- $$$~QPainter[overload1]$$$~QPainter -->
<h3 class="fn" id="dtor.QPainter"><a name="dtor.QPainter"></a>QPainter::<span class="name">~QPainter</span>()</h3>
<p>Destroys the painter.</p>
<!-- @@@~QPainter -->
<!-- $$$background[overload1]$$$background -->
<h3 class="fn" id="background"><a name="background"></a>const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;QPainter::<span class="name">background</span>() const</h3>
<p>Returns the current background brush.</p>
<p><b>See also </b><a href="qpainter.html#setBackground">setBackground</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@background -->
<!-- $$$backgroundMode[overload1]$$$backgroundMode -->
<h3 class="fn" id="backgroundMode"><a name="backgroundMode"></a><span class="type"><a href="../qtcore/qt.html#BGMode-enum">Qt::BGMode</a></span> QPainter::<span class="name">backgroundMode</span>() const</h3>
<p>Returns the current background mode.</p>
<p><b>See also </b><a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@backgroundMode -->
<!-- $$$begin[overload1]$$$beginQPaintDevice* -->
<h3 class="fn" id="begin"><a name="begin"></a><span class="type">bool</span> QPainter::<span class="name">begin</span>(<span class="type"><a href="qpaintdevice.html">QPaintDevice</a></span> *<i>device</i>)</h3>
<p>Begins painting the paint <i>device</i> and returns <code>true</code> if successful; otherwise returns <code>false</code>.</p>
<p>Notice that all painter settings (<a href="qpainter.html#setPen">setPen</a>(), <a href="qpainter.html#setBrush">setBrush</a>() etc.) are reset to default values when begin() is called.</p>
<p>The errors that can occur are serious problems, such as these:</p>
<pre class="cpp">

  painter<span class="operator">-</span><span class="operator">&gt;</span>begin(<span class="number">0</span>); <span class="comment">// impossible - paint device cannot be 0</span>

  <span class="type"><a href="qpixmap.html">QPixmap</a></span> image(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
  painter<span class="operator">-</span><span class="operator">&gt;</span>begin(<span class="operator">&amp;</span>image); <span class="comment">// impossible - image.isNull() == true;</span>

  painter<span class="operator">-</span><span class="operator">&gt;</span>begin(myWidget);
  painter2<span class="operator">-</span><span class="operator">&gt;</span>begin(myWidget); <span class="comment">// impossible - only one painter at a time</span>

</pre>
<p>Note that most of the time, you can use one of the constructors instead of begin(), and that <a href="qpainter.html#end">end</a>() is automatically done at destruction.</p>
<p><b>Warning:</b> A paint device can only be painted by one painter at a time.</p>
<p><b>Warning:</b> Painting on a <a href="qimage.html">QImage</a> with the format <a href="qimage.html#Format-enum">QImage::Format_Indexed8</a> is not supported.</p>
<p><b>See also </b><a href="qpainter.html#end">end</a>() and <a href="qpainter.html#QPainter">QPainter</a>().</p>
<!-- @@@begin -->
<!-- $$$beginNativePainting[overload1]$$$beginNativePainting -->
<h3 class="fn" id="beginNativePainting"><a name="beginNativePainting"></a><span class="type">void</span> QPainter::<span class="name">beginNativePainting</span>()</h3>
<p>Flushes the painting pipeline and prepares for the user issuing commands directly to the underlying graphics context. Must be followed by a call to <a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>
<p>Note that only the states the underlying paint engine changes will be reset to their respective default states. The states we reset may change from release to release. The following states are currently reset in the OpenGL 2 engine:</p>
<ul>
<li>blending is disabled</li>
<li>the depth, stencil and scissor tests are disabled</li>
<li>the active texture unit is reset to 0</li>
<li>the depth mask, depth function and the clear depth are reset to their default values</li>
<li>the stencil mask, stencil operation and stencil function are reset to their default values</li>
<li>the current color is reset to solid white</li>
</ul>
<p>If, for example, the OpenGL polygon mode is changed by the user inside a beginNativePaint()/<a href="qpainter.html#endNativePainting">endNativePainting</a>() block, it will not be reset to the default state by <a href="qpainter.html#endNativePainting">endNativePainting</a>(). Here is an example that shows intermixing of painter commands and raw OpenGL commands:</p>
<pre class="cpp">

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>fillRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>green);
  painter<span class="operator">.</span>beginNativePainting();

  glEnable(GL_SCISSOR_TEST);
  glScissor(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">64</span><span class="operator">,</span> <span class="number">64</span>);

  glClearColor(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
  glClear(GL_COLOR_BUFFER_BIT);

  glDisable(GL_SCISSOR_TEST);

  painter<span class="operator">.</span>endNativePainting();

</pre>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>
<!-- @@@beginNativePainting -->
<!-- $$$boundingRect[overload1]$$$boundingRectconstQRectF&intconstQString& -->
<h3 class="fn" id="boundingRect"><a name="boundingRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QPainter::<span class="name">boundingRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Returns the bounding rectangle of the <i>text</i> as it will appear when drawn inside the given <i>rectangle</i> with the specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>(); i.e the function tells you where the <a href="qpainter.html#drawText">drawText</a>() function will draw when given the same arguments.</p>
<p>If the <i>text</i> does not fit within the given <i>rectangle</i> using the specified <i>flags</i>, the function returns the required rectangle.</p>
<p>The <i>flags</i> argument is a bitwise OR of the following flags:</p>
<ul>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignRight</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignTop</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignBottom</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignVCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignCenter</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextSingleLine</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextExpandTabs</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextShowMnemonic</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextWordWrap</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextIncludeTrailingSpaces</a></li>
</ul>
<p>If several of the horizontal or several of the vertical alignment flags are set, the resulting alignment is undefined.</p>
<p><b>See also </b><a href="qpainter.html#drawText">drawText</a>(), <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::Alignment</a>, and <a href="../qtcore/qt.html#TextFlag-enum">Qt::TextFlag</a>.</p>
<!-- @@@boundingRect -->
<!-- $$$boundingRect$$$boundingRectconstQRect&intconstQString& -->
<h3 class="fn" id="boundingRect-1"><a name="boundingRect-1"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QPainter::<span class="name">boundingRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the bounding rectangle of the <i>text</i> as it will appear when drawn inside the given <i>rectangle</i> with the specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>().</p>
<!-- @@@boundingRect -->
<!-- $$$boundingRect$$$boundingRectintintintintintconstQString& -->
<h3 class="fn" id="boundingRect-2"><a name="boundingRect-2"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QPainter::<span class="name">boundingRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the bounding rectangle of the given <i>text</i> as it will appear when drawn inside the rectangle beginning at the point (<i>x</i>, <i>y</i>) with width <i>w</i> and height <i>h</i>.</p>
<!-- @@@boundingRect -->
<!-- $$$boundingRect$$$boundingRectconstQRectF&constQString&constQTextOption& -->
<h3 class="fn" id="boundingRect-3"><a name="boundingRect-3"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QPainter::<span class="name">boundingRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, const <span class="type"><a href="qtextoption.html">QTextOption</a></span> &amp;<i>option</i> = QTextOption())</h3>
<p>This is an overloaded function.</p>
<p>Instead of specifying flags as a bitwise OR of the <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a> and <a href="../qtcore/qt.html#TextFlag-enum">Qt::TextFlag</a>, this overloaded function takes an <i>option</i> argument. The <a href="qtextoption.html">QTextOption</a> class provides a description of general rich text properties.</p>
<p><b>See also </b><a href="qtextoption.html">QTextOption</a>.</p>
<!-- @@@boundingRect -->
<!-- $$$brush[overload1]$$$brush -->
<h3 class="fn" id="brush"><a name="brush"></a>const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;QPainter::<span class="name">brush</span>() const</h3>
<p>Returns the painter's current brush.</p>
<p><b>See also </b><a href="qpainter.html#setBrush">QPainter::setBrush</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@brush -->
<!-- $$$brushOrigin[overload1]$$$brushOrigin -->
<h3 class="fn" id="brushOrigin"><a name="brushOrigin"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QPainter::<span class="name">brushOrigin</span>() const</h3>
<p>Returns the currently set brush origin.</p>
<p><b>See also </b><a href="qpainter.html#setBrushOrigin">setBrushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@brushOrigin -->
<!-- $$$clipBoundingRect[overload1]$$$clipBoundingRect -->
<h3 class="fn" id="clipBoundingRect"><a name="clipBoundingRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QPainter::<span class="name">clipBoundingRect</span>() const</h3>
<p>Returns the bounding rectangle of the current clip if there is a clip; otherwise returns an empty rectangle. Note that the clip region is given in logical coordinates.</p>
<p>The bounding rectangle is not guaranteed to be tight.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpainter.html#setClipRect">setClipRect</a>(), <a href="qpainter.html#setClipPath">setClipPath</a>(), and <a href="qpainter.html#setClipRegion">setClipRegion</a>().</p>
<!-- @@@clipBoundingRect -->
<!-- $$$clipPath[overload1]$$$clipPath -->
<h3 class="fn" id="clipPath"><a name="clipPath"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> QPainter::<span class="name">clipPath</span>() const</h3>
<p>Returns the current clip path in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not store the combined clip explicitly as this is handled by the underlying <a href="qpaintengine.html">QPaintEngine</a>, so the path is recreated on demand and transformed to the current logical coordinate system. This is potentially an expensive operation.</p>
<p><b>See also </b><a href="qpainter.html#setClipPath">setClipPath</a>(), <a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>
<!-- @@@clipPath -->
<!-- $$$clipRegion[overload1]$$$clipRegion -->
<h3 class="fn" id="clipRegion"><a name="clipRegion"></a><span class="type"><a href="qregion.html">QRegion</a></span> QPainter::<span class="name">clipRegion</span>() const</h3>
<p>Returns the currently set clip region. Note that the clip region is given in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not store the combined clip explicitly as this is handled by the underlying <a href="qpaintengine.html">QPaintEngine</a>, so the path is recreated on demand and transformed to the current logical coordinate system. This is potentially an expensive operation.</p>
<p><b>See also </b><a href="qpainter.html#setClipRegion">setClipRegion</a>(), <a href="qpainter.html#clipPath">clipPath</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>
<!-- @@@clipRegion -->
<!-- $$$combinedTransform[overload1]$$$combinedTransform -->
<h3 class="fn" id="combinedTransform"><a name="combinedTransform"></a><span class="type"><a href="qtransform.html">QTransform</a></span> QPainter::<span class="name">combinedTransform</span>() const</h3>
<p>Returns the transformation matrix combining the current window/viewport and world transformation.</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setWindow">setWindow</a>(), and <a href="qpainter.html#setViewport">setViewport</a>().</p>
<!-- @@@combinedTransform -->
<!-- $$$compositionMode[overload1]$$$compositionMode -->
<h3 class="fn" id="compositionMode"><a name="compositionMode"></a><span class="type"><a href="qpainter.html#CompositionMode-enum">QPainter::CompositionMode</a></span> QPainter::<span class="name">compositionMode</span>() const</h3>
<p>Returns the current composition mode.</p>
<p><b>See also </b><a href="qpainter.html#CompositionMode-enum">CompositionMode</a> and <a href="qpainter.html#setCompositionMode">setCompositionMode</a>().</p>
<!-- @@@compositionMode -->
<!-- $$$device[overload1]$$$device -->
<h3 class="fn" id="device"><a name="device"></a><span class="type"><a href="qpaintdevice.html">QPaintDevice</a></span> *QPainter::<span class="name">device</span>() const</h3>
<p>Returns the paint device on which this painter is currently painting, or <code>nullptr</code> if the painter is not active.</p>
<p><b>See also </b><a href="qpainter.html#isActive">isActive</a>().</p>
<!-- @@@device -->
<!-- $$$deviceTransform[overload1]$$$deviceTransform -->
<h3 class="fn" id="deviceTransform"><a name="deviceTransform"></a>const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;QPainter::<span class="name">deviceTransform</span>() const</h3>
<p>Returns the matrix that transforms from logical coordinates to device coordinates of the platform dependent paint device.</p>
<p>This function is <i>only</i> needed when using platform painting commands on the platform dependent handle (<a href="../qtcore/qt.html#HANDLE-typedef">Qt::HANDLE</a>), and the platform does not do transformations nativly.</p>
<p>The <a href="qpaintengine.html#PaintEngineFeature-enum">QPaintEngine::PaintEngineFeature</a> enum can be queried to determine whether the platform performs the transformations or not.</p>
<p><b>See also </b><a href="qpainter.html#worldTransform">worldTransform</a>() and <a href="qpaintengine.html#hasFeature">QPaintEngine::hasFeature</a>().</p>
<!-- @@@deviceTransform -->
<!-- $$$drawArc[overload1]$$$drawArcconstQRectF&intint -->
<h3 class="fn" id="drawArc"><a name="drawArc"></a><span class="type">void</span> QPainter::<span class="name">drawArc</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>Draws the arc defined by the given <i>rectangle</i>, <i>startAngle</i> and <i>spanAngle</i>.</p>
<p>The <i>startAngle</i> and <i>spanAngle</i> must be specified in 1/16th of a degree, i.e&#x2e; a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-arc.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
  <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
  <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawArc(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawPie">drawPie</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawArc -->
<!-- $$$drawArc$$$drawArcconstQRect&intint -->
<h3 class="fn" id="drawArc-1"><a name="drawArc-1"></a><span class="type">void</span> QPainter::<span class="name">drawArc</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the arc defined by the given <i>rectangle</i>, <i>startAngle</i> and <i>spanAngle</i>.</p>
<!-- @@@drawArc -->
<!-- $$$drawArc$$$drawArcintintintintintint -->
<h3 class="fn" id="drawArc-2"><a name="drawArc-2"></a><span class="type">void</span> QPainter::<span class="name">drawArc</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the arc defined by the rectangle beginning at (<i>x</i>, <i>y</i>) with the specified <i>width</i> and <i>height</i>, and the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<!-- @@@drawArc -->
<!-- $$$drawChord[overload1]$$$drawChordconstQRectF&intint -->
<h3 class="fn" id="drawChord"><a name="drawChord"></a><span class="type">void</span> QPainter::<span class="name">drawChord</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>Draws the chord defined by the given <i>rectangle</i>, <i>startAngle</i> and <i>spanAngle</i>. The chord is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a degree, i.e&#x2e; a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-chord.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
  <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
  <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawChord(rect<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawArc">drawArc</a>(), <a href="qpainter.html#drawPie">drawPie</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawChord -->
<!-- $$$drawChord$$$drawChordintintintintintint -->
<h3 class="fn" id="drawChord-1"><a name="drawChord-1"></a><span class="type">void</span> QPainter::<span class="name">drawChord</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the chord defined by the rectangle beginning at (<i>x</i>, <i>y</i>) with the specified <i>width</i> and <i>height</i>, and the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<!-- @@@drawChord -->
<!-- $$$drawChord$$$drawChordconstQRect&intint -->
<h3 class="fn" id="drawChord-2"><a name="drawChord-2"></a><span class="type">void</span> QPainter::<span class="name">drawChord</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the chord defined by the given <i>rectangle</i>, <i>startAngle</i> and <i>spanAngle</i>.</p>
<!-- @@@drawChord -->
<!-- $$$drawConvexPolygon[overload1]$$$drawConvexPolygonconstQPointF*int -->
<h3 class="fn" id="drawConvexPolygon"><a name="drawConvexPolygon"></a><span class="type">void</span> QPainter::<span class="name">drawConvexPolygon</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>Draws the convex polygon defined by the first <i>pointCount</i> points in the array <i>points</i> using the current pen.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-polygon.png" alt="" /></td><td ><pre class="cpp">

  <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
  };

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawConvexPolygon(points<span class="operator">,</span> <span class="number">4</span>);

</pre>
</td></tr>
</table></div>
<p>The first point is implicitly connected to the last point, and the polygon is filled with the current <a href="qpainter.html#brush">brush</a>(). If the supplied polygon is not convex, i.e&#x2e; it contains at least one angle larger than 180 degrees, the results are undefined.</p>
<p>On some platforms (e.g&#x2e; X11), the drawConvexPolygon() function can be faster than the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function.</p>
<p><b>See also </b><a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawConvexPolygon -->
<!-- $$$drawConvexPolygon$$$drawConvexPolygonconstQPolygonF& -->
<h3 class="fn" id="drawConvexPolygon-1"><a name="drawConvexPolygon-1"></a><span class="type">void</span> QPainter::<span class="name">drawConvexPolygon</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>polygon</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the current pen and brush.</p>
<!-- @@@drawConvexPolygon -->
<!-- $$$drawConvexPolygon$$$drawConvexPolygonconstQPoint*int -->
<h3 class="fn" id="drawConvexPolygon-2"><a name="drawConvexPolygon-2"></a><span class="type">void</span> QPainter::<span class="name">drawConvexPolygon</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by the first <i>pointCount</i> points in the array <i>points</i> using the current pen.</p>
<!-- @@@drawConvexPolygon -->
<!-- $$$drawConvexPolygon$$$drawConvexPolygonconstQPolygon& -->
<h3 class="fn" id="drawConvexPolygon-3"><a name="drawConvexPolygon-3"></a><span class="type">void</span> QPainter::<span class="name">drawConvexPolygon</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>polygon</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the current pen and brush.</p>
<!-- @@@drawConvexPolygon -->
<!-- $$$drawEllipse[overload1]$$$drawEllipseconstQRectF& -->
<h3 class="fn" id="drawEllipse"><a name="drawEllipse"></a><span class="type">void</span> QPainter::<span class="name">drawEllipse</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>)</h3>
<p>Draws the ellipse defined by the given <i>rectangle</i>.</p>
<p>A filled ellipse has a size of <i>rectangle</i>.<a href="../qtcore/qrect.html#size">size()</a>. A stroked ellipse has a size of <i>rectangle</i>.<a href="../qtcore/qrect.html#size">size()</a> plus the pen width.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-ellipse.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawEllipse(rectangle);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawPie">drawPie</a>() and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawEllipse -->
<!-- $$$drawEllipse$$$drawEllipseconstQRect& -->
<h3 class="fn" id="drawEllipse-1"><a name="drawEllipse-1"></a><span class="type">void</span> QPainter::<span class="name">drawEllipse</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the given <i>rectangle</i>.</p>
<!-- @@@drawEllipse -->
<!-- $$$drawEllipse$$$drawEllipseintintintint -->
<h3 class="fn" id="drawEllipse-2"><a name="drawEllipse-2"></a><span class="type">void</span> QPainter::<span class="name">drawEllipse</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@drawEllipse -->
<!-- $$$drawEllipse$$$drawEllipseconstQPointF&qrealqreal -->
<h3 class="fn" id="drawEllipse-3"><a name="drawEllipse-3"></a><span class="type">void</span> QPainter::<span class="name">drawEllipse</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>center</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>rx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>ry</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii <i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@drawEllipse -->
<!-- $$$drawEllipse$$$drawEllipseconstQPoint&intint -->
<h3 class="fn" id="drawEllipse-4"><a name="drawEllipse-4"></a><span class="type">void</span> QPainter::<span class="name">drawEllipse</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>center</i>, <span class="type">int</span> <i>rx</i>, <span class="type">int</span> <i>ry</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii <i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@drawEllipse -->
<!-- $$$drawGlyphRun[overload1]$$$drawGlyphRunconstQPointF&constQGlyphRun& -->
<h3 class="fn" id="drawGlyphRun"><a name="drawGlyphRun"></a><span class="type">void</span> QPainter::<span class="name">drawGlyphRun</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i>, const <span class="type"><a href="qglyphrun.html">QGlyphRun</a></span> &amp;<i>glyphs</i>)</h3>
<p>Draws the glyphs represented by <i>glyphs</i> at <i>position</i>. The <i>position</i> gives the edge of the baseline for the string of glyphs. The glyphs will be retrieved from the font selected on <i>glyphs</i> and at offsets given by the positions in <i>glyphs</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qglyphrun.html#setRawFont">QGlyphRun::setRawFont</a>(), <a href="qglyphrun.html#setPositions">QGlyphRun::setPositions</a>(), and <a href="qglyphrun.html#setGlyphIndexes">QGlyphRun::setGlyphIndexes</a>().</p>
<!-- @@@drawGlyphRun -->
<!-- $$$drawImage[overload1]$$$drawImageconstQRectF&constQImage&constQRectF&Qt::ImageConversionFlags -->
<h3 class="fn" id="drawImage"><a name="drawImage"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>target</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>source</i>, <span class="type"><a href="../qtcore/qt.html#ImageConversionFlag-enum">Qt::ImageConversionFlags</a></span> <i>flags</i> = Qt::AutoColor)</h3>
<p>Draws the rectangular portion <i>source</i> of the given <i>image</i> into the <i>target</i> rectangle in the paint device.</p>
<p><b>Note: </b>The image is scaled to fit the rectangle, if both the image and rectangle size disagree.</p><p><b>Note: </b>See <a href="qpainter.html#drawing-high-resolution-versions-of-pixmaps-and-images">Drawing High Resolution Versions of Pixmaps and Images</a> on how this is affected by <a href="qimage.html#devicePixelRatio">QImage::devicePixelRatio</a>().</p><p>If the image needs to be modified to fit in a lower-resolution result (e.g&#x2e; converting from 32-bit to 8-bit), use the <i>flags</i> to specify how you would prefer this to happen.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
  <span class="type"><a href="qimage.html">QImage</a></span> image(<span class="string">&quot;:/images/myImage.png&quot;</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawImage(target<span class="operator">,</span> image<span class="operator">,</span> source);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawPixmap">drawPixmap</a>() and <a href="qimage.html#devicePixelRatio">QImage::devicePixelRatio</a>().</p>
<!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQRect&constQImage&constQRect&Qt::ImageConversionFlags -->
<h3 class="fn" id="drawImage-1"><a name="drawImage-1"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>target</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>source</i>, <span class="type"><a href="../qtcore/qt.html#ImageConversionFlag-enum">Qt::ImageConversionFlags</a></span> <i>flags</i> = Qt::AutoColor)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>image</i> into the <i>target</i> rectangle in the paint device.</p>
<p><b>Note: </b>The image is scaled to fit the rectangle, if both the image and rectangle size disagree.</p><!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQPointF&constQImage&constQRectF&Qt::ImageConversionFlags -->
<h3 class="fn" id="drawImage-2"><a name="drawImage-2"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>source</i>, <span class="type"><a href="../qtcore/qt.html#ImageConversionFlag-enum">Qt::ImageConversionFlags</a></span> <i>flags</i> = ...)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>image</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQPoint&constQImage&constQRect&Qt::ImageConversionFlags -->
<h3 class="fn" id="drawImage-3"><a name="drawImage-3"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>source</i>, <span class="type"><a href="../qtcore/qt.html#ImageConversionFlag-enum">Qt::ImageConversionFlags</a></span> <i>flags</i> = ...)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>image</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQRectF&constQImage& -->
<h3 class="fn" id="drawImage-4"><a name="drawImage-4"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given <i>rectangle</i>.</p>
<p><b>Note: </b>The image is scaled to fit the rectangle, if both the image and rectangle size disagree.</p><!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQRect&constQImage& -->
<h3 class="fn" id="drawImage-5"><a name="drawImage-5"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given <i>rectangle</i>.</p>
<p><b>Note: </b>The image is scaled to fit the rectangle, if both the image and rectangle size disagree.</p><!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQPointF&constQImage& -->
<h3 class="fn" id="drawImage-6"><a name="drawImage-6"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>
<!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageconstQPoint&constQImage& -->
<h3 class="fn" id="drawImage-7"><a name="drawImage-7"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>
<!-- @@@drawImage -->
<!-- $$$drawImage$$$drawImageintintconstQImage&intintintintQt::ImageConversionFlags -->
<h3 class="fn" id="drawImage-8"><a name="drawImage-8"></a><span class="type">void</span> QPainter::<span class="name">drawImage</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, <span class="type">int</span> <i>sx</i> = 0, <span class="type">int</span> <i>sy</i> = 0, <span class="type">int</span> <i>sw</i> = -1, <span class="type">int</span> <i>sh</i> = -1, <span class="type"><a href="../qtcore/qt.html#ImageConversionFlag-enum">Qt::ImageConversionFlags</a></span> <i>flags</i> = Qt::AutoColor)</h3>
<p>This is an overloaded function.</p>
<p>Draws an image at (<i>x</i>, <i>y</i>) by copying a part of <i>image</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies the top-left point in <i>image</i> that is to be drawn. The default is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the image that is to be drawn. The default, (0, 0) (and negative) means all the way to the bottom-right of the image.</p>
<!-- @@@drawImage -->
<!-- $$$drawLine[overload1]$$$drawLineconstQLineF& -->
<h3 class="fn" id="drawLine"><a name="drawLine"></a><span class="type">void</span> QPainter::<span class="name">drawLine</span>(const <span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> &amp;<i>line</i>)</h3>
<p>Draws a line defined by <i>line</i>.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-line.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> line(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">90.0</span><span class="operator">,</span> <span class="number">20.0</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span>(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawLine(line);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawLine -->
<!-- $$$drawLine$$$drawLineconstQLine& -->
<h3 class="fn" id="drawLine-1"><a name="drawLine-1"></a><span class="type">void</span> QPainter::<span class="name">drawLine</span>(const <span class="type"><a href="../qtcore/qline.html">QLine</a></span> &amp;<i>line</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line defined by <i>line</i>.</p>
<!-- @@@drawLine -->
<!-- $$$drawLine$$$drawLineintintintint -->
<h3 class="fn" id="drawLine-2"><a name="drawLine-2"></a><span class="type">void</span> QPainter::<span class="name">drawLine</span>(<span class="type">int</span> <i>x1</i>, <span class="type">int</span> <i>y1</i>, <span class="type">int</span> <i>x2</i>, <span class="type">int</span> <i>y2</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line from (<i>x1</i>, <i>y1</i>) to (<i>x2</i>, <i>y2</i>).</p>
<!-- @@@drawLine -->
<!-- $$$drawLine$$$drawLineconstQPoint&constQPoint& -->
<h3 class="fn" id="drawLine-3"><a name="drawLine-3"></a><span class="type">void</span> QPainter::<span class="name">drawLine</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>p1</i>, const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>p2</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>
<!-- @@@drawLine -->
<!-- $$$drawLine$$$drawLineconstQPointF&constQPointF& -->
<h3 class="fn" id="drawLine-4"><a name="drawLine-4"></a><span class="type">void</span> QPainter::<span class="name">drawLine</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>p1</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>p2</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>
<!-- @@@drawLine -->
<!-- $$$drawLines[overload1]$$$drawLinesconstQLineF*int -->
<h3 class="fn" id="drawLines"><a name="drawLines"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> *<i>lines</i>, <span class="type">int</span> <i>lineCount</i>)</h3>
<p>Draws the first <i>lineCount</i> lines in the array <i>lines</i> using the current pen.</p>
<p><b>See also </b><a href="qpainter.html#drawLine">drawLine</a>() and <a href="qpainter.html#drawPolyline">drawPolyline</a>().</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQVector<QLineF>& -->
<h3 class="fn" id="drawLines-1"><a name="drawLines-1"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span>&gt; &amp;<i>lines</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using the current pen and brush.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQPointF*int -->
<h3 class="fn" id="drawLines-2"><a name="drawLines-2"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> *<i>pointPairs</i>, <span class="type">int</span> <i>lineCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array <i>pointPairs</i> using the current pen. The lines are specified as pairs of points so the number of entries in <i>pointPairs</i> must be at least <i>lineCount</i> * 2.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQVector<QPointF>& -->
<h3 class="fn" id="drawLines-3"><a name="drawLines-3"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>&gt; &amp;<i>pointPairs</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector <i>pointPairs</i> using the current pen. If there is an odd number of points in the array, the last point will be ignored.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQLine*int -->
<h3 class="fn" id="drawLines-4"><a name="drawLines-4"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qline.html">QLine</a></span> *<i>lines</i>, <span class="type">int</span> <i>lineCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array <i>lines</i> using the current pen.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQVector<QLine>& -->
<h3 class="fn" id="drawLines-5"><a name="drawLines-5"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qline.html">QLine</a></span>&gt; &amp;<i>lines</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using the current pen and brush.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQPoint*int -->
<h3 class="fn" id="drawLines-6"><a name="drawLines-6"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> *<i>pointPairs</i>, <span class="type">int</span> <i>lineCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array <i>pointPairs</i> using the current pen.</p>
<!-- @@@drawLines -->
<!-- $$$drawLines$$$drawLinesconstQVector<QPoint>& -->
<h3 class="fn" id="drawLines-7"><a name="drawLines-7"></a><span class="type">void</span> QPainter::<span class="name">drawLines</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span>&gt; &amp;<i>pointPairs</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector <i>pointPairs</i> using the current pen.</p>
<!-- @@@drawLines -->
<!-- $$$drawPath[overload1]$$$drawPathconstQPainterPath& -->
<h3 class="fn" id="drawPath"><a name="drawPath"></a><span class="type">void</span> QPainter::<span class="name">drawPath</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>)</h3>
<p>Draws the given painter <i>path</i> using the current pen for outline and the current brush for filling.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-path.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> path;
  path<span class="operator">.</span>moveTo(<span class="number">20</span><span class="operator">,</span> <span class="number">80</span>);
  path<span class="operator">.</span>lineTo(<span class="number">20</span><span class="operator">,</span> <span class="number">30</span>);
  path<span class="operator">.</span>cubicTo(<span class="number">80</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">80</span><span class="operator">,</span> <span class="number">80</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPath(path);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="../qtwidgets/qtwidgets-painting-painterpaths-example.html">the Painter Paths example</a> and <a href="../qtwidgets/qtwidgets-painting-deform-example.html">the Vector Deformation example</a>.</p>
<!-- @@@drawPath -->
<!-- $$$drawPicture[overload1]$$$drawPictureconstQPointF&constQPicture& -->
<h3 class="fn" id="drawPicture"><a name="drawPicture"></a><span class="type">void</span> QPainter::<span class="name">drawPicture</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpicture.html">QPicture</a></span> &amp;<i>picture</i>)</h3>
<p>Replays the given <i>picture</i> at the given <i>point</i>.</p>
<p>The <a href="qpicture.html">QPicture</a> class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands. A picture serializes the painter commands to an IO device in a platform-independent format. Everything that can be painted on a widget or pixmap can also be stored in a picture.</p>
<p>This function does exactly the same as <a href="qpicture.html#play">QPicture::play</a>() when called with <i>point</i> = <a href="../qtcore/qpoint.html">QPoint</a>(0, 0).</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><pre class="cpp">

  <span class="type"><a href="qpicture.html">QPicture</a></span> picture;
  <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> point(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span>)
  picture<span class="operator">.</span>load(<span class="string">&quot;drawing.pic&quot;</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPicture(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> picture);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpicture.html#play">QPicture::play</a>().</p>
<!-- @@@drawPicture -->
<!-- $$$drawPicture$$$drawPictureintintconstQPicture& -->
<h3 class="fn" id="drawPicture-1"><a name="drawPicture-1"></a><span class="type">void</span> QPainter::<span class="name">drawPicture</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, const <span class="type"><a href="qpicture.html">QPicture</a></span> &amp;<i>picture</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>picture</i> at point (<i>x</i>, <i>y</i>).</p>
<!-- @@@drawPicture -->
<!-- $$$drawPicture$$$drawPictureconstQPoint&constQPicture& -->
<h3 class="fn" id="drawPicture-2"><a name="drawPicture-2"></a><span class="type">void</span> QPainter::<span class="name">drawPicture</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpicture.html">QPicture</a></span> &amp;<i>picture</i>)</h3>
<p>This is an overloaded function.</p>
<p>Replays the given <i>picture</i> at the given <i>point</i>.</p>
<!-- @@@drawPicture -->
<!-- $$$drawPie[overload1]$$$drawPieconstQRectF&intint -->
<h3 class="fn" id="drawPie"><a name="drawPie"></a><span class="type">void</span> QPainter::<span class="name">drawPie</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>Draws a pie defined by the given <i>rectangle</i>, <i>startAngle</i> and <i>spanAngle</i>.</p>
<p>The pie is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a degree, i.e&#x2e; a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-pie.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
  <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
  <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPie(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawPie -->
<!-- $$$drawPie$$$drawPieintintintintintint -->
<h3 class="fn" id="drawPie-1"><a name="drawPie-1"></a><span class="type">void</span> QPainter::<span class="name">drawPie</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the pie defined by the rectangle beginning at (<i>x</i>, <i>y</i>) with the specified <i>width</i> and <i>height</i>, and the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<!-- @@@drawPie -->
<!-- $$$drawPie$$$drawPieconstQRect&intint -->
<h3 class="fn" id="drawPie-2"><a name="drawPie-2"></a><span class="type">void</span> QPainter::<span class="name">drawPie</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>startAngle</i>, <span class="type">int</span> <i>spanAngle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a pie defined by the given <i>rectangle</i>, <i>startAngle</i> and and <i>spanAngle</i>.</p>
<!-- @@@drawPie -->
<!-- $$$drawPixmap[overload1]$$$drawPixmapconstQRectF&constQPixmap&constQRectF& -->
<h3 class="fn" id="drawPixmap"><a name="drawPixmap"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>target</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>source</i>)</h3>
<p>Draws the rectangular portion <i>source</i> of the given <i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note: </b>The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.</p><p><b>Note: </b>See <a href="qpainter.html#drawing-high-resolution-versions-of-pixmaps-and-images">Drawing High Resolution Versions of Pixmaps and Images</a> on how this is affected by <a href="qpixmap.html#devicePixelRatio">QPixmap::devicePixelRatio</a>().</p><div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
  <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">&quot;:myPixmap.png&quot;</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span>(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPixmap(target<span class="operator">,</span> pixmap<span class="operator">,</span> source);

</pre>
</td></tr>
</table></div>
<p>If <i>pixmap</i> is a <a href="qbitmap.html">QBitmap</a> it is drawn with the bits that are &quot;set&quot; using the pens color. If <a href="qpainter.html#backgroundMode">backgroundMode</a> is <a href="../qtcore/qt.html#BGMode-enum">Qt::OpaqueMode</a>, the &quot;unset&quot; bits are drawn using the color of the background brush; if <a href="qpainter.html#backgroundMode">backgroundMode</a> is <a href="../qtcore/qt.html#BGMode-enum">Qt::TransparentMode</a>, the &quot;unset&quot; bits are transparent. Drawing bitmaps with gradient or texture colors is not supported.</p>
<p><b>See also </b><a href="qpainter.html#drawImage">drawImage</a>() and <a href="qpixmap.html#devicePixelRatio">QPixmap::devicePixelRatio</a>().</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQRect&constQPixmap&constQRect& -->
<h3 class="fn" id="drawPixmap-1"><a name="drawPixmap-1"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>target</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>source</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note: </b>The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.</p><!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapintintintintconstQPixmap&intintintint -->
<h3 class="fn" id="drawPixmap-2"><a name="drawPixmap-2"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, <span class="type">int</span> <i>sx</i>, <span class="type">int</span> <i>sy</i>, <span class="type">int</span> <i>sw</i>, <span class="type">int</span> <i>sh</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion with the origin (<i>sx</i>, <i>sy</i>), width <i>sw</i> and height <i>sh</i>, of the given <i>pixmap</i> , at the point (<i>x</i>, <i>y</i>), with a width of <i>w</i> and a height of <i>h</i>. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy;</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapintintconstQPixmap&intintintint -->
<h3 class="fn" id="drawPixmap-3"><a name="drawPixmap-3"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, <span class="type">int</span> <i>sx</i>, <span class="type">int</span> <i>sy</i>, <span class="type">int</span> <i>sw</i>, <span class="type">int</span> <i>sh</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a pixmap at (<i>x</i>, <i>y</i>) by copying a part of the given <i>pixmap</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies the top-left point in <i>pixmap</i> that is to be drawn. The default is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the pixmap that is to be drawn. The default, (0, 0) (and negative) means all the way to the bottom-right of the pixmap.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQPointF&constQPixmap&constQRectF& -->
<h3 class="fn" id="drawPixmap-4"><a name="drawPixmap-4"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>source</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>pixmap</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQPoint&constQPixmap&constQRect& -->
<h3 class="fn" id="drawPixmap-5"><a name="drawPixmap-5"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>source</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given <i>pixmap</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQPointF&constQPixmap& -->
<h3 class="fn" id="drawPixmap-6"><a name="drawPixmap-6"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQPoint&constQPixmap& -->
<h3 class="fn" id="drawPixmap-7"><a name="drawPixmap-7"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given <i>point</i>.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapintintconstQPixmap& -->
<h3 class="fn" id="drawPixmap-8"><a name="drawPixmap-8"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> at position (<i>x</i>, <i>y</i>).</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapconstQRect&constQPixmap& -->
<h3 class="fn" id="drawPixmap-9"><a name="drawPixmap-9"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> into the given <i>rectangle</i>.</p>
<p><b>Note: </b>The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.</p><!-- @@@drawPixmap -->
<!-- $$$drawPixmap$$$drawPixmapintintintintconstQPixmap& -->
<h3 class="fn" id="drawPixmap-10"><a name="drawPixmap-10"></a><span class="type">void</span> QPainter::<span class="name">drawPixmap</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the <i>pixmap</i> into the rectangle at position (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@drawPixmap -->
<!-- $$$drawPixmapFragments[overload1]$$$drawPixmapFragmentsconstQPainter::PixmapFragment*intconstQPixmap&QPainter::PixmapFragmentHints -->
<h3 class="fn" id="drawPixmapFragments"><a name="drawPixmapFragments"></a><span class="type">void</span> QPainter::<span class="name">drawPixmapFragments</span>(const <span class="type"><a href="qpainter-pixmapfragment.html">QPainter::PixmapFragment</a></span> *<i>fragments</i>, <span class="type">int</span> <i>fragmentCount</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, <span class="type"><a href="qpainter.html#PixmapFragmentHint-enum">QPainter::PixmapFragmentHints</a></span> <i>hints</i> = PixmapFragmentHints())</h3>
<p>This function is used to draw <i>pixmap</i>, or a sub-rectangle of <i>pixmap</i>, at multiple positions with different scale, rotation and opacity. <i>fragments</i> is an array of <i>fragmentCount</i> elements specifying the parameters used to draw each pixmap fragment. The <i>hints</i> parameter can be used to pass in drawing hints.</p>
<p>This function is potentially faster than multiple calls to <a href="qpainter.html#drawPixmap">drawPixmap</a>(), since the backend can optimize state changes.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also </b><a href="qpainter-pixmapfragment.html">QPainter::PixmapFragment</a> and <a href="qpainter.html#PixmapFragmentHint-enum">QPainter::PixmapFragmentHint</a>.</p>
<!-- @@@drawPixmapFragments -->
<!-- $$$drawPoint[overload1]$$$drawPointconstQPointF& -->
<h3 class="fn" id="drawPoint"><a name="drawPoint"></a><span class="type">void</span> QPainter::<span class="name">drawPoint</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i>)</h3>
<p>Draws a single point at the given <i>position</i> using the current pen's color.</p>
<p><b>See also </b><a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawPoint -->
<!-- $$$drawPoint$$$drawPointconstQPoint& -->
<h3 class="fn" id="drawPoint-1"><a name="drawPoint-1"></a><span class="type">void</span> QPainter::<span class="name">drawPoint</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a single point at the given <i>position</i> using the current pen's color.</p>
<!-- @@@drawPoint -->
<!-- $$$drawPoint$$$drawPointintint -->
<h3 class="fn" id="drawPoint-2"><a name="drawPoint-2"></a><span class="type">void</span> QPainter::<span class="name">drawPoint</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a single point at position (<i>x</i>, <i>y</i>).</p>
<!-- @@@drawPoint -->
<!-- $$$drawPoints[overload1]$$$drawPointsconstQPointF*int -->
<h3 class="fn" id="drawPoints"><a name="drawPoints"></a><span class="type">void</span> QPainter::<span class="name">drawPoints</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>Draws the first <i>pointCount</i> points in the array <i>points</i> using the current pen's color.</p>
<p><b>See also </b><a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawPoints -->
<!-- $$$drawPoints$$$drawPointsconstQPolygonF& -->
<h3 class="fn" id="drawPoints-1"><a name="drawPoints-1"></a><span class="type">void</span> QPainter::<span class="name">drawPoints</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>points</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>
<!-- @@@drawPoints -->
<!-- $$$drawPoints$$$drawPointsconstQPoint*int -->
<h3 class="fn" id="drawPoints-2"><a name="drawPoints-2"></a><span class="type">void</span> QPainter::<span class="name">drawPoints</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the first <i>pointCount</i> points in the array <i>points</i> using the current pen's color.</p>
<!-- @@@drawPoints -->
<!-- $$$drawPoints$$$drawPointsconstQPolygon& -->
<h3 class="fn" id="drawPoints-3"><a name="drawPoints-3"></a><span class="type">void</span> QPainter::<span class="name">drawPoints</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>points</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>
<!-- @@@drawPoints -->
<!-- $$$drawPolygon[overload1]$$$drawPolygonconstQPointF*intQt::FillRule -->
<h3 class="fn" id="drawPolygon"><a name="drawPolygon"></a><span class="type">void</span> QPainter::<span class="name">drawPolygon</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>, <span class="type"><a href="../qtcore/qt.html#FillRule-enum">Qt::FillRule</a></span> <i>fillRule</i> = Qt::OddEvenFill)</h3>
<p>Draws the polygon defined by the first <i>pointCount</i> points in the array <i>points</i> using the current pen and brush.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-polygon.png" alt="" /></td><td ><pre class="cpp">

  <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
  };

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPolygon(points<span class="operator">,</span> <span class="number">4</span>);

</pre>
</td></tr>
</table></div>
<p>The first point is implicitly connected to the last point, and the polygon is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>If <i>fillRule</i> is <a href="../qtcore/qt.html#FillRule-enum">Qt::WindingFill</a>, the polygon is filled using the winding fill algorithm. If <i>fillRule</i> is <a href="../qtcore/qt.html#FillRule-enum">Qt::OddEvenFill</a>, the polygon is filled using the odd-even fill algorithm. See <a href="../qtcore/qt.html#FillRule-enum">Qt::FillRule</a> for a more detailed description of these fill rules.</p>
<p><b>See also </b><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawPolygon -->
<!-- $$$drawPolygon$$$drawPolygonconstQPolygonF&Qt::FillRule -->
<h3 class="fn" id="drawPolygon-1"><a name="drawPolygon-1"></a><span class="type">void</span> QPainter::<span class="name">drawPolygon</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>points</i>, <span class="type"><a href="../qtcore/qt.html#FillRule-enum">Qt::FillRule</a></span> <i>fillRule</i> = Qt::OddEvenFill)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polygon defined by the given <i>points</i> using the fill rule <i>fillRule</i>.</p>
<!-- @@@drawPolygon -->
<!-- $$$drawPolygon$$$drawPolygonconstQPoint*intQt::FillRule -->
<h3 class="fn" id="drawPolygon-2"><a name="drawPolygon-2"></a><span class="type">void</span> QPainter::<span class="name">drawPolygon</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>, <span class="type"><a href="../qtcore/qt.html#FillRule-enum">Qt::FillRule</a></span> <i>fillRule</i> = Qt::OddEvenFill)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polygon defined by the first <i>pointCount</i> points in the array <i>points</i>.</p>
<!-- @@@drawPolygon -->
<!-- $$$drawPolygon$$$drawPolygonconstQPolygon&Qt::FillRule -->
<h3 class="fn" id="drawPolygon-3"><a name="drawPolygon-3"></a><span class="type">void</span> QPainter::<span class="name">drawPolygon</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>points</i>, <span class="type"><a href="../qtcore/qt.html#FillRule-enum">Qt::FillRule</a></span> <i>fillRule</i> = Qt::OddEvenFill)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polygon defined by the given <i>points</i> using the fill rule <i>fillRule</i>.</p>
<!-- @@@drawPolygon -->
<!-- $$$drawPolyline[overload1]$$$drawPolylineconstQPointF*int -->
<h3 class="fn" id="drawPolyline"><a name="drawPolyline"></a><span class="type">void</span> QPainter::<span class="name">drawPolyline</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>Draws the polyline defined by the first <i>pointCount</i> points in <i>points</i> using the current pen.</p>
<p>Note that unlike the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function the last point is <i>not</i> connected to the first, neither is the polyline filled.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><pre class="cpp">

  <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">3</span><span class="operator">]</span> <span class="operator">=</span> {
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
      <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
  };

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawPolyline(points<span class="operator">,</span> <span class="number">3</span>);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawPolyline -->
<!-- $$$drawPolyline$$$drawPolylineconstQPolygonF& -->
<h3 class="fn" id="drawPolyline-1"><a name="drawPolyline-1"></a><span class="type">void</span> QPainter::<span class="name">drawPolyline</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>points</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polyline defined by the given <i>points</i> using the current pen.</p>
<!-- @@@drawPolyline -->
<!-- $$$drawPolyline$$$drawPolylineconstQPoint*int -->
<h3 class="fn" id="drawPolyline-2"><a name="drawPolyline-2"></a><span class="type">void</span> QPainter::<span class="name">drawPolyline</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> *<i>points</i>, <span class="type">int</span> <i>pointCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polyline defined by the first <i>pointCount</i> points in <i>points</i> using the current pen.</p>
<!-- @@@drawPolyline -->
<!-- $$$drawPolyline$$$drawPolylineconstQPolygon& -->
<h3 class="fn" id="drawPolyline-3"><a name="drawPolyline-3"></a><span class="type">void</span> QPainter::<span class="name">drawPolyline</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>points</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the polyline defined by the given <i>points</i> using the current pen.</p>
<!-- @@@drawPolyline -->
<!-- $$$drawRect[overload1]$$$drawRectconstQRectF& -->
<h3 class="fn" id="drawRect"><a name="drawRect"></a><span class="type">void</span> QPainter::<span class="name">drawRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>)</h3>
<p>Draws the current <i>rectangle</i> with the current pen and brush.</p>
<p>A filled rectangle has a size of <i>rectangle</i>.size(). A stroked rectangle has a size of <i>rectangle</i>.size() plus the pen width.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-rectangle.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawRect(rectangle);

</pre>
</td></tr>
</table></div>
<p><b>See also </b><a href="qpainter.html#drawRects">drawRects</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@drawRect -->
<!-- $$$drawRect$$$drawRectintintintint -->
<h3 class="fn" id="drawRect-1"><a name="drawRect-1"></a><span class="type">void</span> QPainter::<span class="name">drawRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws a rectangle with upper left corner at (<i>x</i>, <i>y</i>) and with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@drawRect -->
<!-- $$$drawRect$$$drawRectconstQRect& -->
<h3 class="fn" id="drawRect-2"><a name="drawRect-2"></a><span class="type">void</span> QPainter::<span class="name">drawRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the current <i>rectangle</i> with the current pen and brush.</p>
<!-- @@@drawRect -->
<!-- $$$drawRects[overload1]$$$drawRectsconstQRectF*int -->
<h3 class="fn" id="drawRects"><a name="drawRects"></a><span class="type">void</span> QPainter::<span class="name">drawRects</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> *<i>rectangles</i>, <span class="type">int</span> <i>rectCount</i>)</h3>
<p>Draws the first <i>rectCount</i> of the given <i>rectangles</i> using the current pen and brush.</p>
<p><b>See also </b><a href="qpainter.html#drawRect">drawRect</a>().</p>
<!-- @@@drawRects -->
<!-- $$$drawRects$$$drawRectsconstQVector<QRectF>& -->
<h3 class="fn" id="drawRects-1"><a name="drawRects-1"></a><span class="type">void</span> QPainter::<span class="name">drawRects</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>&gt; &amp;<i>rectangles</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and brush.</p>
<!-- @@@drawRects -->
<!-- $$$drawRects$$$drawRectsconstQRect*int -->
<h3 class="fn" id="drawRects-2"><a name="drawRects-2"></a><span class="type">void</span> QPainter::<span class="name">drawRects</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> *<i>rectangles</i>, <span class="type">int</span> <i>rectCount</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the first <i>rectCount</i> of the given <i>rectangles</i> using the current pen and brush.</p>
<!-- @@@drawRects -->
<!-- $$$drawRects$$$drawRectsconstQVector<QRect>& -->
<h3 class="fn" id="drawRects-3"><a name="drawRects-3"></a><span class="type">void</span> QPainter::<span class="name">drawRects</span>(const <span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="../qtcore/qrect.html">QRect</a></span>&gt; &amp;<i>rectangles</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and brush.</p>
<!-- @@@drawRects -->
<!-- $$$drawRoundedRect[overload1]$$$drawRoundedRectconstQRectF&qrealqrealQt::SizeMode -->
<h3 class="fn" id="drawRoundedRect"><a name="drawRoundedRect"></a><span class="type">void</span> QPainter::<span class="name">drawRoundedRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>xRadius</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>yRadius</i>, <span class="type"><a href="../qtcore/qt.html#SizeMode-enum">Qt::SizeMode</a></span> <i>mode</i> = Qt::AbsoluteSize)</h3>
<p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>The <i>xRadius</i> and <i>yRadius</i> arguments specify the radii of the ellipses defining the corners of the rounded rectangle. When <i>mode</i> is <a href="../qtcore/qt.html#SizeMode-enum">Qt::RelativeSize</a>, <i>xRadius</i> and <i>yRadius</i> are specified in percentage of half the rectangle's width and height respectively, and should be in the range 0.0 to 100.0&#x2e;</p>
<p>A filled rectangle has a size of rect.size(). A stroked rectangle has a size of rect.size() plus the pen width.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-roundrect.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawRoundedRect(rectangle<span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">15.0</span>);

</pre>
</td></tr>
</table></div>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qpainter.html#drawRect">drawRect</a>() and <a href="qpen.html">QPen</a>.</p>
<!-- @@@drawRoundedRect -->
<!-- $$$drawRoundedRect$$$drawRoundedRectintintintintqrealqrealQt::SizeMode -->
<h3 class="fn" id="drawRoundedRect-1"><a name="drawRoundedRect-1"></a><span class="type">void</span> QPainter::<span class="name">drawRoundedRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>xRadius</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>yRadius</i>, <span class="type"><a href="../qtcore/qt.html#SizeMode-enum">Qt::SizeMode</a></span> <i>mode</i> = ...)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>x</i>, <i>y</i>, <i>w</i>, <i>h</i> with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@drawRoundedRect -->
<!-- $$$drawRoundedRect$$$drawRoundedRectconstQRect&qrealqrealQt::SizeMode -->
<h3 class="fn" id="drawRoundedRect-2"><a name="drawRoundedRect-2"></a><span class="type">void</span> QPainter::<span class="name">drawRoundedRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rect</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>xRadius</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>yRadius</i>, <span class="type"><a href="../qtcore/qt.html#SizeMode-enum">Qt::SizeMode</a></span> <i>mode</i> = ...)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@drawRoundedRect -->
<!-- $$$drawStaticText[overload1]$$$drawStaticTextconstQPointF&constQStaticText& -->
<h3 class="fn" id="drawStaticText"><a name="drawStaticText"></a><span class="type">void</span> QPainter::<span class="name">drawStaticText</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>topLeftPosition</i>, const <span class="type"><a href="qstatictext.html">QStaticText</a></span> &amp;<i>staticText</i>)</h3>
<p>Draws the given <i>staticText</i> at the given <i>topLeftPosition</i>.</p>
<p>The text will be drawn using the font and the transformation set on the painter. If the font and/or transformation set on the painter are different from the ones used to initialize the layout of the <a href="qstatictext.html">QStaticText</a>, then the layout will have to be recalculated. Use <a href="qstatictext.html#prepare">QStaticText::prepare</a>() to initialize <i>staticText</i> with the font and transformation with which it will later be drawn.</p>
<p>If <i>topLeftPosition</i> is not the same as when <i>staticText</i> was initialized, or when it was last drawn, then there will be a slight overhead when translating the text to its new position.</p>
<p><b>Note: </b>If the painter's transformation is not affine, then <i>staticText</i> will be drawn using regular calls to <a href="qpainter.html#drawText">drawText</a>(), losing any potential for performance improvement.</p><p><b>Note: </b>The y-position is used as the top of the font.</p><p>This function was introduced in Qt 4.7.</p>
<p><b>See also </b><a href="qstatictext.html">QStaticText</a>.</p>
<!-- @@@drawStaticText -->
<!-- $$$drawStaticText$$$drawStaticTextconstQPoint&constQStaticText& -->
<h3 class="fn" id="drawStaticText-1"><a name="drawStaticText-1"></a><span class="type">void</span> QPainter::<span class="name">drawStaticText</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>topLeftPosition</i>, const <span class="type"><a href="qstatictext.html">QStaticText</a></span> &amp;<i>staticText</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at the <i>topLeftPosition</i>.</p>
<p><b>Note: </b>The y-position is used as the top of the font.</p><p>This function was introduced in Qt 4.7.</p>
<!-- @@@drawStaticText -->
<!-- $$$drawStaticText$$$drawStaticTextintintconstQStaticText& -->
<h3 class="fn" id="drawStaticText-2"><a name="drawStaticText-2"></a><span class="type">void</span> QPainter::<span class="name">drawStaticText</span>(<span class="type">int</span> <i>left</i>, <span class="type">int</span> <i>top</i>, const <span class="type"><a href="qstatictext.html">QStaticText</a></span> &amp;<i>staticText</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at coordinates <i>left</i> and <i>top</i>.</p>
<p><b>Note: </b>The y-position is used as the top of the font.</p><p>This function was introduced in Qt 4.7.</p>
<!-- @@@drawStaticText -->
<!-- $$$drawText[overload1]$$$drawTextconstQRectF&intconstQString&QRectF* -->
<h3 class="fn" id="drawText"><a name="drawText"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> *<i>boundingRect</i> = nullptr)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> within the provided <i>rectangle</i>. The <i>rectangle</i> along with alignment <i>flags</i> defines the anchors for the <i>text</i>.</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-text.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  painter<span class="operator">.</span>drawText(rect<span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>AlignCenter<span class="operator">,</span> tr(<span class="string">&quot;Qt\nProject&quot;</span>));

</pre>
</td></tr>
</table></div>
<p>The <i>boundingRect</i> (if not null) is set to what the bounding rectangle should be in order to enclose the whole text. For example, in the following image, the dotted line represents <i>boundingRect</i> as calculated by the function, and the dashed line represents <i>rectangle</i>:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-text-bounds.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  <span class="type"><a href="qfont.html">QFont</a></span> font <span class="operator">=</span> painter<span class="operator">.</span>font();
  font<span class="operator">.</span>setPixelSize(<span class="number">48</span>);
  painter<span class="operator">.</span>setFont(font);

  <span class="keyword">const</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> rectangle <span class="operator">=</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">50</span>);
  <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> boundingRect;
  painter<span class="operator">.</span>drawText(rectangle<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> tr(<span class="string">&quot;Hello&quot;</span>)<span class="operator">,</span> <span class="operator">&amp;</span>boundingRect);

  <span class="type"><a href="qpen.html">QPen</a></span> pen <span class="operator">=</span> painter<span class="operator">.</span>pen();
  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DotLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(boundingRect<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DashLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(rectangle<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

</pre>
</td></tr>
</table></div>
<p>The <i>flags</i> argument is a bitwise OR of the following flags:</p>
<ul>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignRight</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignJustify</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignTop</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignBottom</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignVCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignCenter</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextDontClip</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextSingleLine</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextExpandTabs</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextShowMnemonic</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextWordWrap</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextIncludeTrailingSpaces</a></li>
</ul>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-coordinate of <i>rectangle</i> is used as the top of the font.</p><p><b>See also </b><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a>, <a href="../qtcore/qt.html#TextFlag-enum">Qt::TextFlag</a>, <a href="qpainter.html#boundingRect">boundingRect</a>(), and <a href="qpainter.html#layoutDirection">layoutDirection</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText[overload1]$$$drawTextconstQPointF&constQString& -->
<h3 class="fn" id="drawText"><a name="drawText"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Draws the given <i>text</i> with the currently defined text direction, beginning at the given <i>position</i>.</p>
<p>This function does not handle the newline character (\n), as it cannot break text into multiple lines, and it cannot display the newline character. Use the QPainter::drawText() overload that takes a rectangle instead if you want to draw multiple lines of text with the newline character, or if you want the text to be wrapped.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-position is used as the baseline of the font.</p><p><b>See also </b><a href="qpainter.html#setFont">setFont</a>() and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText$$$drawTextconstQPoint&constQString& -->
<h3 class="fn" id="drawText-1"><a name="drawText-1"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>position</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> with the currently defined text direction, beginning at the given <i>position</i>.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-position is used as the baseline of the font.</p><p><b>See also </b><a href="qpainter.html#setFont">setFont</a>() and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText$$$drawTextintintconstQString& -->
<h3 class="fn" id="drawText-2"><a name="drawText-2"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> at position (<i>x</i>, <i>y</i>), using the painter's currently defined text direction.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-position is used as the baseline of the font.</p><p><b>See also </b><a href="qpainter.html#setFont">setFont</a>() and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText$$$drawTextconstQRect&intconstQString&QRect* -->
<h3 class="fn" id="drawText-3"><a name="drawText-3"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> *<i>boundingRect</i> = nullptr)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> within the provided <i>rectangle</i> according to the specified <i>flags</i>.</p>
<p>The <i>boundingRect</i> (if not null) is set to the what the bounding rectangle should be in order to enclose the whole text. For example, in the following image, the dotted line represents <i>boundingRect</i> as calculated by the function, and the dashed line represents <i>rectangle</i>:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-text-bounds.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  <span class="type"><a href="qfont.html">QFont</a></span> font <span class="operator">=</span> painter<span class="operator">.</span>font();
  font<span class="operator">.</span>setPixelSize(<span class="number">48</span>);
  painter<span class="operator">.</span>setFont(font);

  <span class="keyword">const</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> rectangle <span class="operator">=</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">50</span>);
  <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> boundingRect;
  painter<span class="operator">.</span>drawText(rectangle<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> tr(<span class="string">&quot;Hello&quot;</span>)<span class="operator">,</span> <span class="operator">&amp;</span>boundingRect);

  <span class="type"><a href="qpen.html">QPen</a></span> pen <span class="operator">=</span> painter<span class="operator">.</span>pen();
  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DotLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(boundingRect<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DashLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(rectangle<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

</pre>
</td></tr>
</table></div>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-coordinate of <i>rectangle</i> is used as the top of the font.</p><p><b>See also </b><a href="qpainter.html#setFont">setFont</a>() and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText$$$drawTextintintintintintconstQString&QRect* -->
<h3 class="fn" id="drawText-4"><a name="drawText-4"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> *<i>boundingRect</i> = nullptr)</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> within the rectangle with origin (<i>x</i>, <i>y</i>), <i>width</i> and <i>height</i>.</p>
<p>The <i>boundingRect</i> (if not null) is set to the what the bounding rectangle should be in order to enclose the whole text. For example, in the following image, the dotted line represents <i>boundingRect</i> as calculated by the function, and the dashed line represents the rectangle defined by <i>x</i>, <i>y</i>, <i>width</i> and <i>height</i>:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qpainter-text-bounds.png" alt="" /></td><td ><pre class="cpp">

  <span class="type"><a href="qpainter.html#QPainter">QPainter</a></span> painter(<span class="keyword">this</span>);
  <span class="type"><a href="qfont.html">QFont</a></span> font <span class="operator">=</span> painter<span class="operator">.</span>font();
  font<span class="operator">.</span>setPixelSize(<span class="number">48</span>);
  painter<span class="operator">.</span>setFont(font);

  <span class="keyword">const</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> rectangle <span class="operator">=</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">50</span>);
  <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> boundingRect;
  painter<span class="operator">.</span>drawText(rectangle<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> tr(<span class="string">&quot;Hello&quot;</span>)<span class="operator">,</span> <span class="operator">&amp;</span>boundingRect);

  <span class="type"><a href="qpen.html">QPen</a></span> pen <span class="operator">=</span> painter<span class="operator">.</span>pen();
  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DotLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(boundingRect<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

  pen<span class="operator">.</span>setStyle(<span class="type">Qt</span><span class="operator">::</span>DashLine);
  painter<span class="operator">.</span>setPen(pen);
  painter<span class="operator">.</span>drawRect(rectangle<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()<span class="operator">,</span> <span class="operator">-</span>pen<span class="operator">.</span>width()));

</pre>
</td></tr>
</table></div>
<p>The <i>flags</i> argument is a bitwise OR of the following flags:</p>
<ul>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignRight</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignJustify</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignTop</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignBottom</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignVCenter</a></li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignCenter</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextSingleLine</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextExpandTabs</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextShowMnemonic</a></li>
<li><a href="../qtcore/qt.html#TextFlag-enum">Qt::TextWordWrap</a></li>
</ul>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-position is used as the top of the font.</p><p><b>See also </b><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a>, <a href="../qtcore/qt.html#TextFlag-enum">Qt::TextFlag</a>, <a href="qpainter.html#setFont">setFont</a>(), and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawText$$$drawTextconstQRectF&constQString&constQTextOption& -->
<h3 class="fn" id="drawText-5"><a name="drawText-5"></a><span class="type">void</span> QPainter::<span class="name">drawText</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, const <span class="type"><a href="qtextoption.html">QTextOption</a></span> &amp;<i>option</i> = QTextOption())</h3>
<p>This is an overloaded function.</p>
<p>Draws the given <i>text</i> in the <i>rectangle</i> specified using the <i>option</i> to control its positioning and orientation.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text anti-aliased.</p>
<p><b>Note: </b>The y-coordinate of <i>rectangle</i> is used as the top of the font.</p><p><b>See also </b><a href="qpainter.html#setFont">setFont</a>() and <a href="qpainter.html#setPen">setPen</a>().</p>
<!-- @@@drawText -->
<!-- $$$drawTiledPixmap[overload1]$$$drawTiledPixmapconstQRectF&constQPixmap&constQPointF& -->
<h3 class="fn" id="drawTiledPixmap"><a name="drawTiledPixmap"></a><span class="type">void</span> QPainter::<span class="name">drawTiledPixmap</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i> = QPointF())</h3>
<p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i> with its origin at the given <i>position</i>.</p>
<p>Calling drawTiledPixmap() is similar to calling <a href="qpainter.html#drawPixmap">drawPixmap</a>() several times to fill (tile) an area with a pixmap, but is potentially much more efficient depending on the underlying window system.</p>
<p>drawTiledPixmap() will produce the same visual tiling pattern on high-dpi displays (with devicePixelRatio &gt; 1), compared to normal- dpi displays. Set the devicePixelRatio on the <i>pixmap</i> to control the tile size. For example, setting it to 2 halves the tile width and height (on both 1x and 2x displays), and produces high-resolution output on 2x displays.</p>
<p>The <i>position</i> offset is always in the painter coordinate system, indepentent of display devicePixelRatio.</p>
<p><b>See also </b><a href="qpainter.html#drawPixmap">drawPixmap</a>().</p>
<!-- @@@drawTiledPixmap -->
<!-- $$$drawTiledPixmap$$$drawTiledPixmapintintintintconstQPixmap&intint -->
<h3 class="fn" id="drawTiledPixmap-1"><a name="drawTiledPixmap-1"></a><span class="type">void</span> QPainter::<span class="name">drawTiledPixmap</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, <span class="type">int</span> <i>sx</i> = 0, <span class="type">int</span> <i>sy</i> = 0)</h3>
<p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i> in the specified rectangle.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint device that is to be drawn onto; with the given <i>width</i> and <i>height</i>. (<i>sx</i>, <i>sy</i>) specifies the top-left point in the <i>pixmap</i> that is to be drawn; this defaults to (0, 0).</p>
<!-- @@@drawTiledPixmap -->
<!-- $$$drawTiledPixmap$$$drawTiledPixmapconstQRect&constQPixmap&constQPoint& -->
<h3 class="fn" id="drawTiledPixmap-2"><a name="drawTiledPixmap-2"></a><span class="type">void</span> QPainter::<span class="name">drawTiledPixmap</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp;<i>pixmap</i>, const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>position</i> = ...)</h3>
<p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i> with its origin at the given <i>position</i>.</p>
<!-- @@@drawTiledPixmap -->
<!-- $$$end[overload1]$$$end -->
<h3 class="fn" id="end"><a name="end"></a><span class="type">bool</span> QPainter::<span class="name">end</span>()</h3>
<p>Ends painting. Any resources used while painting are released. You don't normally need to call this since it is called by the destructor.</p>
<p>Returns <code>true</code> if the painter is no longer active; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#isActive">isActive</a>().</p>
<!-- @@@end -->
<!-- $$$endNativePainting[overload1]$$$endNativePainting -->
<h3 class="fn" id="endNativePainting"><a name="endNativePainting"></a><span class="type">void</span> QPainter::<span class="name">endNativePainting</span>()</h3>
<p>Restores the painter after manually issuing native painting commands. Lets the painter restore any native state that it relies on before calling any other painter commands.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qpainter.html#beginNativePainting">beginNativePainting</a>().</p>
<!-- @@@endNativePainting -->
<!-- $$$eraseRect[overload1]$$$eraseRectconstQRectF& -->
<h3 class="fn" id="eraseRect"><a name="eraseRect"></a><span class="type">void</span> QPainter::<span class="name">eraseRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>)</h3>
<p>Erases the area inside the given <i>rectangle</i>. Equivalent to calling</p>
<pre class="cpp">

  fillRect(rectangle<span class="operator">,</span> background())<span class="operator">.</span>

</pre>
<p><b>See also </b><a href="qpainter.html#fillRect">fillRect</a>().</p>
<!-- @@@eraseRect -->
<!-- $$$eraseRect$$$eraseRectintintintint -->
<h3 class="fn" id="eraseRect-1"><a name="eraseRect-1"></a><span class="type">void</span> QPainter::<span class="name">eraseRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>This is an overloaded function.</p>
<p>Erases the area inside the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@eraseRect -->
<!-- $$$eraseRect$$$eraseRectconstQRect& -->
<h3 class="fn" id="eraseRect-2"><a name="eraseRect-2"></a><span class="type">void</span> QPainter::<span class="name">eraseRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Erases the area inside the given <i>rectangle</i>.</p>
<!-- @@@eraseRect -->
<!-- $$$fillPath[overload1]$$$fillPathconstQPainterPath&constQBrush& -->
<h3 class="fn" id="fillPath"><a name="fillPath"></a><span class="type">void</span> QPainter::<span class="name">fillPath</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>, const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Fills the given <i>path</i> using the given <i>brush</i>. The outline is not drawn.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a> constructor (taking a <a href="qcolor.html">QColor</a> argument) will automatically create a solid pattern brush.</p>
<p><b>See also </b><a href="qpainter.html#drawPath">drawPath</a>().</p>
<!-- @@@fillPath -->
<!-- $$$fillRect[overload1]$$$fillRectconstQRectF&constQBrush& -->
<h3 class="fn" id="fillRect"><a name="fillRect"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Fills the given <i>rectangle</i> with the <i>brush</i> specified.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a> constructor (taking a <a href="qcolor.html">QColor</a> argument) will automatically create a solid pattern brush.</p>
<p><b>See also </b><a href="qpainter.html#drawRect">drawRect</a>().</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectintintintintconstQBrush& -->
<h3 class="fn" id="fillRect-1"><a name="fillRect-1"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>, using the given <i>brush</i>.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRect&constQBrush& -->
<h3 class="fn" id="fillRect-2"><a name="fillRect-2"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified <i>brush</i>.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRectF&constQColor& -->
<h3 class="fn" id="fillRect-3"><a name="fillRect-3"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i> specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectintintintintconstQColor& -->
<h3 class="fn" id="fillRect-4"><a name="fillRect-4"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>, using the given <i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRect&constQColor& -->
<h3 class="fn" id="fillRect-5"><a name="fillRect-5"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i> specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectintintintintQt::GlobalColor -->
<h3 class="fn" id="fillRect-6"><a name="fillRect-6"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type"><a href="../qtcore/qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>, using the given <i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRect&Qt::GlobalColor -->
<h3 class="fn" id="fillRect-7"><a name="fillRect-7"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified <i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRectF&Qt::GlobalColor -->
<h3 class="fn" id="fillRect-8"><a name="fillRect-8"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified <i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectintintintintQt::BrushStyle -->
<h3 class="fn" id="fillRect-9"><a name="fillRect-9"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type"><a href="../qtcore/qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>, using the brush <i>style</i> specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRect&Qt::BrushStyle -->
<h3 class="fn" id="fillRect-10"><a name="fillRect-10"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i> specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRectF&Qt::BrushStyle -->
<h3 class="fn" id="fillRect-11"><a name="fillRect-11"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i> specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectintintintintQGradient::Preset -->
<h3 class="fn" id="fillRect-12"><a name="fillRect-12"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type"><a href="qgradient.html#Preset-enum">QGradient::Preset</a></span> <i>preset</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>, using the given gradient <i>preset</i>.</p>
<p>This function was introduced in Qt 5.12.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRect&QGradient::Preset -->
<h3 class="fn" id="fillRect-13"><a name="fillRect-13"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="qgradient.html#Preset-enum">QGradient::Preset</a></span> <i>preset</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified gradient <i>preset</i>.</p>
<p>This function was introduced in Qt 5.12.</p>
<!-- @@@fillRect -->
<!-- $$$fillRect$$$fillRectconstQRectF&QGradient::Preset -->
<h3 class="fn" id="fillRect-14"><a name="fillRect-14"></a><span class="type">void</span> QPainter::<span class="name">fillRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="qgradient.html#Preset-enum">QGradient::Preset</a></span> <i>preset</i>)</h3>
<p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified gradient <i>preset</i>.</p>
<p>This function was introduced in Qt 5.12.</p>
<!-- @@@fillRect -->
<!-- $$$font[overload1]$$$font -->
<h3 class="fn" id="font"><a name="font"></a>const <span class="type"><a href="qfont.html">QFont</a></span> &amp;QPainter::<span class="name">font</span>() const</h3>
<p>Returns the currently set font used for drawing text.</p>
<p><b>See also </b><a href="qpainter.html#setFont">setFont</a>(), <a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@font -->
<!-- $$$fontInfo[overload1]$$$fontInfo -->
<h3 class="fn" id="fontInfo"><a name="fontInfo"></a><span class="type"><a href="qfontinfo.html">QFontInfo</a></span> QPainter::<span class="name">fontInfo</span>() const</h3>
<p>Returns the font info for the painter if the painter is active. Otherwise, the return value is undefined.</p>
<p><b>See also </b><a href="qpainter.html#font">font</a>(), <a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@fontInfo -->
<!-- $$$fontMetrics[overload1]$$$fontMetrics -->
<h3 class="fn" id="fontMetrics"><a name="fontMetrics"></a><span class="type"><a href="qfontmetrics.html">QFontMetrics</a></span> QPainter::<span class="name">fontMetrics</span>() const</h3>
<p>Returns the font metrics for the painter if the painter is active. Otherwise, the return value is undefined.</p>
<p><b>See also </b><a href="qpainter.html#font">font</a>(), <a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@fontMetrics -->
<!-- $$$hasClipping[overload1]$$$hasClipping -->
<h3 class="fn" id="hasClipping"><a name="hasClipping"></a><span class="type">bool</span> QPainter::<span class="name">hasClipping</span>() const</h3>
<p>Returns <code>true</code> if clipping has been set; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qpainter.html#setClipping">setClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>
<!-- @@@hasClipping -->
<!-- $$$isActive[overload1]$$$isActive -->
<h3 class="fn" id="isActive"><a name="isActive"></a><span class="type">bool</span> QPainter::<span class="name">isActive</span>() const</h3>
<p>Returns <code>true</code> if <a href="qpainter.html#begin">begin</a>() has been called and <a href="qpainter.html#end">end</a>() has not yet been called; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qpainter.html#begin">begin</a>() and <a href="qpaintdevice.html#paintingActive">QPaintDevice::paintingActive</a>().</p>
<!-- @@@isActive -->
<!-- $$$layoutDirection[overload1]$$$layoutDirection -->
<h3 class="fn" id="layoutDirection"><a name="layoutDirection"></a><span class="type"><a href="../qtcore/qt.html#LayoutDirection-enum">Qt::LayoutDirection</a></span> QPainter::<span class="name">layoutDirection</span>() const</h3>
<p>Returns the layout direction used by the painter when drawing text.</p>
<p><b>See also </b><a href="qtextoption.html#textDirection">QTextOption::textDirection</a>(), <a href="qpainter.html#setLayoutDirection">setLayoutDirection</a>(), <a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@layoutDirection -->
<!-- $$$opacity[overload1]$$$opacity -->
<h3 class="fn" id="opacity"><a name="opacity"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QPainter::<span class="name">opacity</span>() const</h3>
<p>Returns the opacity of the painter. The default value is 1.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qpainter.html#setOpacity">setOpacity</a>().</p>
<!-- @@@opacity -->
<!-- $$$paintEngine[overload1]$$$paintEngine -->
<h3 class="fn" id="paintEngine"><a name="paintEngine"></a><span class="type"><a href="qpaintengine.html">QPaintEngine</a></span> *QPainter::<span class="name">paintEngine</span>() const</h3>
<p>Returns the paint engine that the painter is currently operating on if the painter is active; otherwise 0.</p>
<p><b>See also </b><a href="qpainter.html#isActive">isActive</a>().</p>
<!-- @@@paintEngine -->
<!-- $$$pen[overload1]$$$pen -->
<h3 class="fn" id="pen"><a name="pen"></a>const <span class="type"><a href="qpen.html">QPen</a></span> &amp;QPainter::<span class="name">pen</span>() const</h3>
<p>Returns the painter's current pen.</p>
<p><b>See also </b><a href="qpainter.html#setPen">setPen</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@pen -->
<!-- $$$renderHints[overload1]$$$renderHints -->
<h3 class="fn" id="renderHints"><a name="renderHints"></a><span class="type"><a href="qpainter.html#RenderHint-enum">QPainter::RenderHints</a></span> QPainter::<span class="name">renderHints</span>() const</h3>
<p>Returns a flag that specifies the rendering hints that are set for this painter.</p>
<p><b>See also </b><a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#testRenderHint">testRenderHint</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<!-- @@@renderHints -->
<!-- $$$resetTransform[overload1]$$$resetTransform -->
<h3 class="fn" id="resetTransform"><a name="resetTransform"></a><span class="type">void</span> QPainter::<span class="name">resetTransform</span>()</h3>
<p>Resets any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>().</p>
<p><b>See also </b><a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@resetTransform -->
<!-- $$$restore[overload1]$$$restore -->
<h3 class="fn" id="restore"><a name="restore"></a><span class="type">void</span> QPainter::<span class="name">restore</span>()</h3>
<p>Restores the current painter state (pops a saved state off the stack).</p>
<p><b>See also </b><a href="qpainter.html#save">save</a>().</p>
<!-- @@@restore -->
<!-- $$$rotate[overload1]$$$rotateqreal -->
<h3 class="fn" id="rotate"><a name="rotate"></a><span class="type">void</span> QPainter::<span class="name">rotate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i>)</h3>
<p>Rotates the coordinate system clockwise. The given <i>angle</i> parameter is in degrees.</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@rotate -->
<!-- $$$save[overload1]$$$save -->
<h3 class="fn" id="save"><a name="save"></a><span class="type">void</span> QPainter::<span class="name">save</span>()</h3>
<p>Saves the current painter state (pushes the state onto a stack). A save() must be followed by a corresponding <a href="qpainter.html#restore">restore</a>(); the <a href="qpainter.html#end">end</a>() function unwinds the stack.</p>
<p><b>See also </b><a href="qpainter.html#restore">restore</a>().</p>
<!-- @@@save -->
<!-- $$$scale[overload1]$$$scaleqrealqreal -->
<h3 class="fn" id="scale"><a name="scale"></a><span class="type">void</span> QPainter::<span class="name">scale</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sy</i>)</h3>
<p>Scales the coordinate system by (<i>sx</i>, <i>sy</i>).</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@scale -->
<!-- $$$setBackground[overload1]$$$setBackgroundconstQBrush& -->
<h3 class="fn" id="setBackground"><a name="setBackground"></a><span class="type">void</span> QPainter::<span class="name">setBackground</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Sets the background brush of the painter to the given <i>brush</i>.</p>
<p>The background brush is the brush that is filled in when drawing opaque text, stippled lines and bitmaps. The background brush has no effect in transparent background mode (which is the default).</p>
<p><b>See also </b><a href="qpainter.html#background">background</a>(), <a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setBackground -->
<!-- $$$setBackgroundMode[overload1]$$$setBackgroundModeQt::BGMode -->
<h3 class="fn" id="setBackgroundMode"><a name="setBackgroundMode"></a><span class="type">void</span> QPainter::<span class="name">setBackgroundMode</span>(<span class="type"><a href="../qtcore/qt.html#BGMode-enum">Qt::BGMode</a></span> <i>mode</i>)</h3>
<p>Sets the background mode of the painter to the given <i>mode</i></p>
<p><a href="../qtcore/qt.html#BGMode-enum">Qt::TransparentMode</a> (the default) draws stippled lines and text without setting the background pixels. <a href="../qtcore/qt.html#BGMode-enum">Qt::OpaqueMode</a> fills these space with the current background color.</p>
<p>Note that in order to draw a bitmap or pixmap transparently, you must use <a href="qpixmap.html#setMask">QPixmap::setMask</a>().</p>
<p><b>See also </b><a href="qpainter.html#backgroundMode">backgroundMode</a>(), <a href="qpainter.html#setBackground">setBackground</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setBackgroundMode -->
<!-- $$$setBrush[overload1]$$$setBrushconstQBrush& -->
<h3 class="fn" id="setBrush"><a name="setBrush"></a><span class="type">void</span> QPainter::<span class="name">setBrush</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Sets the painter's brush to the given <i>brush</i>.</p>
<p>The painter's brush defines how shapes are filled.</p>
<p><b>See also </b><a href="qpainter.html#brush">brush</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setBrush -->
<!-- $$$setBrush$$$setBrushQt::BrushStyle -->
<h3 class="fn" id="setBrush-1"><a name="setBrush-1"></a><span class="type">void</span> QPainter::<span class="name">setBrush</span>(<span class="type"><a href="../qtcore/qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the painter's brush to black color and the specified <i>style</i>.</p>
<!-- @@@setBrush -->
<!-- $$$setBrushOrigin[overload1]$$$setBrushOriginconstQPointF& -->
<h3 class="fn" id="setBrushOrigin"><a name="setBrushOrigin"></a><span class="type">void</span> QPainter::<span class="name">setBrushOrigin</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i>)</h3>
<p>Sets the brush origin to <i>position</i>.</p>
<p>The brush origin specifies the (0, 0) coordinate of the painter's brush.</p>
<p>Note that while the <a href="qpainter.html#brushOrigin">brushOrigin</a>() was necessary to adopt the parent's background for a widget in Qt 3, this is no longer the case since the Qt 4 painter doesn't paint the background unless you explicitly tell it to do so by setting the widget's <a href="../qtwidgets/qwidget.html#autoFillBackground-prop">autoFillBackground</a> property to true.</p>
<p><b>See also </b><a href="qpainter.html#brushOrigin">brushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setBrushOrigin -->
<!-- $$$setBrushOrigin$$$setBrushOriginintint -->
<h3 class="fn" id="setBrushOrigin-1"><a name="setBrushOrigin-1"></a><span class="type">void</span> QPainter::<span class="name">setBrushOrigin</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the brush's origin to point (<i>x</i>, <i>y</i>).</p>
<!-- @@@setBrushOrigin -->
<!-- $$$setBrushOrigin$$$setBrushOriginconstQPoint& -->
<h3 class="fn" id="setBrushOrigin-2"><a name="setBrushOrigin-2"></a><span class="type">void</span> QPainter::<span class="name">setBrushOrigin</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the brush's origin to the given <i>position</i>.</p>
<!-- @@@setBrushOrigin -->
<!-- $$$setClipPath[overload1]$$$setClipPathconstQPainterPath&Qt::ClipOperation -->
<h3 class="fn" id="setClipPath"><a name="setClipPath"></a><span class="type">void</span> QPainter::<span class="name">setClipPath</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>, <span class="type"><a href="../qtcore/qt.html#ClipOperation-enum">Qt::ClipOperation</a></span> <i>operation</i> = Qt::ReplaceClip)</h3>
<p>Enables clipping, and sets the clip path for the painter to the given <i>path</i>, with the clip <i>operation</i>.</p>
<p>Note that the clip path is specified in logical (painter) coordinates.</p>
<p><b>See also </b><a href="qpainter.html#clipPath">clipPath</a>(), <a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<!-- @@@setClipPath -->
<!-- $$$setClipRect[overload1]$$$setClipRectconstQRectF&Qt::ClipOperation -->
<h3 class="fn" id="setClipRect"><a name="setClipRect"></a><span class="type">void</span> QPainter::<span class="name">setClipRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#ClipOperation-enum">Qt::ClipOperation</a></span> <i>operation</i> = Qt::ReplaceClip)</h3>
<p>Enables clipping, and sets the clip region to the given <i>rectangle</i> using the given clip <i>operation</i>. The default operation is to replace the current clip rectangle.</p>
<p>Note that the clip rectangle is specified in logical (painter) coordinates.</p>
<p><b>See also </b><a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipping">setClipping</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<!-- @@@setClipRect -->
<!-- $$$setClipRect$$$setClipRectconstQRect&Qt::ClipOperation -->
<h3 class="fn" id="setClipRect-1"><a name="setClipRect-1"></a><span class="type">void</span> QPainter::<span class="name">setClipRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>, <span class="type"><a href="../qtcore/qt.html#ClipOperation-enum">Qt::ClipOperation</a></span> <i>operation</i> = Qt::ReplaceClip)</h3>
<p>This is an overloaded function.</p>
<p>Enables clipping, and sets the clip region to the given <i>rectangle</i> using the given clip <i>operation</i>.</p>
<!-- @@@setClipRect -->
<!-- $$$setClipRect$$$setClipRectintintintintQt::ClipOperation -->
<h3 class="fn" id="setClipRect-2"><a name="setClipRect-2"></a><span class="type">void</span> QPainter::<span class="name">setClipRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type"><a href="../qtcore/qt.html#ClipOperation-enum">Qt::ClipOperation</a></span> <i>operation</i> = Qt::ReplaceClip)</h3>
<p>Enables clipping, and sets the clip region to the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@setClipRect -->
<!-- $$$setClipRegion[overload1]$$$setClipRegionconstQRegion&Qt::ClipOperation -->
<h3 class="fn" id="setClipRegion"><a name="setClipRegion"></a><span class="type">void</span> QPainter::<span class="name">setClipRegion</span>(const <span class="type"><a href="qregion.html">QRegion</a></span> &amp;<i>region</i>, <span class="type"><a href="../qtcore/qt.html#ClipOperation-enum">Qt::ClipOperation</a></span> <i>operation</i> = Qt::ReplaceClip)</h3>
<p>Sets the clip region to the given <i>region</i> using the specified clip <i>operation</i>. The default clip operation is to replace the current clip region.</p>
<p>Note that the clip region is given in logical coordinates.</p>
<p><b>See also </b><a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipRect">setClipRect</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<!-- @@@setClipRegion -->
<!-- $$$setClipping[overload1]$$$setClippingbool -->
<h3 class="fn" id="setClipping"><a name="setClipping"></a><span class="type">void</span> QPainter::<span class="name">setClipping</span>(<span class="type">bool</span> <i>enable</i>)</h3>
<p>Enables clipping if <i>enable</i> is true, or disables clipping if <i>enable</i> is false.</p>
<p><b>See also </b><a href="qpainter.html#hasClipping">hasClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>
<!-- @@@setClipping -->
<!-- $$$setCompositionMode[overload1]$$$setCompositionModeQPainter::CompositionMode -->
<h3 class="fn" id="setCompositionMode"><a name="setCompositionMode"></a><span class="type">void</span> QPainter::<span class="name">setCompositionMode</span>(<span class="type"><a href="qpainter.html#CompositionMode-enum">QPainter::CompositionMode</a></span> <i>mode</i>)</h3>
<p>Sets the composition mode to the given <i>mode</i>.</p>
<p><b>Warning:</b> Only a <a href="qpainter.html">QPainter</a> operating on a <a href="qimage.html">QImage</a> fully supports all composition modes. The RasterOp modes are supported for X11 as described in <a href="qpainter.html#compositionMode">compositionMode</a>().</p>
<p><b>See also </b><a href="qpainter.html#compositionMode">compositionMode</a>().</p>
<!-- @@@setCompositionMode -->
<!-- $$$setFont[overload1]$$$setFontconstQFont& -->
<h3 class="fn" id="setFont"><a name="setFont"></a><span class="type">void</span> QPainter::<span class="name">setFont</span>(const <span class="type"><a href="qfont.html">QFont</a></span> &amp;<i>font</i>)</h3>
<p>Sets the painter's font to the given <i>font</i>.</p>
<p>This font is used by subsequent <a href="qpainter.html#drawText">drawText</a>() functions. The text color is the same as the pen color.</p>
<p>If you set a font that isn't available, Qt finds a close match. <a href="qpainter.html#font">font</a>() will return what you set using setFont() and <a href="qpainter.html#fontInfo">fontInfo</a>() returns the font actually being used (which may be the same).</p>
<p><b>See also </b><a href="qpainter.html#font">font</a>(), <a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setFont -->
<!-- $$$setLayoutDirection[overload1]$$$setLayoutDirectionQt::LayoutDirection -->
<h3 class="fn" id="setLayoutDirection"><a name="setLayoutDirection"></a><span class="type">void</span> QPainter::<span class="name">setLayoutDirection</span>(<span class="type"><a href="../qtcore/qt.html#LayoutDirection-enum">Qt::LayoutDirection</a></span> <i>direction</i>)</h3>
<p>Sets the layout direction used by the painter when drawing text, to the specified <i>direction</i>.</p>
<p>The default is <a href="../qtcore/qt.html#LayoutDirection-enum">Qt::LayoutDirectionAuto</a>, which will implicitly determine the direction from the text drawn.</p>
<p><b>See also </b><a href="qtextoption.html#setTextDirection">QTextOption::setTextDirection</a>(), <a href="qpainter.html#layoutDirection">layoutDirection</a>(), <a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setLayoutDirection -->
<!-- $$$setOpacity[overload1]$$$setOpacityqreal -->
<h3 class="fn" id="setOpacity"><a name="setOpacity"></a><span class="type">void</span> QPainter::<span class="name">setOpacity</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>opacity</i>)</h3>
<p>Sets the opacity of the painter to <i>opacity</i>. The value should be in the range 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is fully opaque.</p>
<p>Opacity set on the painter will apply to all drawing operations individually.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qpainter.html#opacity">opacity</a>().</p>
<!-- @@@setOpacity -->
<!-- $$$setPen[overload1]$$$setPenconstQPen& -->
<h3 class="fn" id="setPen"><a name="setPen"></a><span class="type">void</span> QPainter::<span class="name">setPen</span>(const <span class="type"><a href="qpen.html">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Sets the painter's pen to be the given <i>pen</i>.</p>
<p>The <i>pen</i> defines how to draw lines and outlines, and it also defines the text color.</p>
<p><b>See also </b><a href="qpainter.html#pen">pen</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<!-- @@@setPen -->
<!-- $$$setPen$$$setPenconstQColor& -->
<h3 class="fn" id="setPen-1"><a name="setPen-1"></a><span class="type">void</span> QPainter::<span class="name">setPen</span>(const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the painter's pen to have style <a href="../qtcore/qt.html#PenStyle-enum">Qt::SolidLine</a>, width 1 and the specified <i>color</i>.</p>
<!-- @@@setPen -->
<!-- $$$setPen$$$setPenQt::PenStyle -->
<h3 class="fn" id="setPen-2"><a name="setPen-2"></a><span class="type">void</span> QPainter::<span class="name">setPen</span>(<span class="type"><a href="../qtcore/qt.html#PenStyle-enum">Qt::PenStyle</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the painter's pen to have the given <i>style</i>, width 1 and black color.</p>
<!-- @@@setPen -->
<!-- $$$setRenderHint[overload1]$$$setRenderHintQPainter::RenderHintbool -->
<h3 class="fn" id="setRenderHint"><a name="setRenderHint"></a><span class="type">void</span> QPainter::<span class="name">setRenderHint</span>(<span class="type"><a href="qpainter.html#RenderHint-enum">QPainter::RenderHint</a></span> <i>hint</i>, <span class="type">bool</span> <i>on</i> = true)</h3>
<p>Sets the given render <i>hint</i> on the painter if <i>on</i> is true; otherwise clears the render hint.</p>
<p><b>See also </b><a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<!-- @@@setRenderHint -->
<!-- $$$setRenderHints[overload1]$$$setRenderHintsQPainter::RenderHintsbool -->
<h3 class="fn" id="setRenderHints"><a name="setRenderHints"></a><span class="type">void</span> QPainter::<span class="name">setRenderHints</span>(<span class="type"><a href="qpainter.html#RenderHint-enum">QPainter::RenderHints</a></span> <i>hints</i>, <span class="type">bool</span> <i>on</i> = true)</h3>
<p>Sets the given render <i>hints</i> on the painter if <i>on</i> is true; otherwise clears the render hints.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<!-- @@@setRenderHints -->
<!-- $$$setTransform[overload1]$$$setTransformconstQTransform&bool -->
<h3 class="fn" id="setTransform"><a name="setTransform"></a><span class="type">void</span> QPainter::<span class="name">setTransform</span>(const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;<i>transform</i>, <span class="type">bool</span> <i>combine</i> = false)</h3>
<p>Sets the world transformation matrix. If <i>combine</i> is true, the specified <i>transform</i> is combined with the current matrix; otherwise it replaces the current matrix.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qpainter.html#transform">transform</a>() and <a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>
<!-- @@@setTransform -->
<!-- $$$setViewTransformEnabled[overload1]$$$setViewTransformEnabledbool -->
<h3 class="fn" id="setViewTransformEnabled"><a name="setViewTransformEnabled"></a><span class="type">void</span> QPainter::<span class="name">setViewTransformEnabled</span>(<span class="type">bool</span> <i>enable</i>)</h3>
<p>Enables view transformations if <i>enable</i> is true, or disables view transformations if <i>enable</i> is false.</p>
<p><b>See also </b><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>() and <a href="coordsys.html#window-viewport-conversion">Window-Viewport Conversion</a>.</p>
<!-- @@@setViewTransformEnabled -->
<!-- $$$setViewport[overload1]$$$setViewportconstQRect& -->
<h3 class="fn" id="setViewport"><a name="setViewport"></a><span class="type">void</span> QPainter::<span class="name">setViewport</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Sets the painter's viewport rectangle to the given <i>rectangle</i>, and enables view transformations.</p>
<p>The viewport rectangle is part of the view transformation. The viewport specifies the device coordinate system. Its sister, the <a href="qpainter.html#window">window</a>(), specifies the logical coordinate system.</p>
<p>The default viewport rectangle is the same as the device's rectangle.</p>
<p><b>See also </b><a href="qpainter.html#viewport">viewport</a>(), <a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(), and <a href="coordsys.html#window-viewport-conversion">Window-Viewport Conversion</a>.</p>
<!-- @@@setViewport -->
<!-- $$$setViewport$$$setViewportintintintint -->
<h3 class="fn" id="setViewport-1"><a name="setViewport-1"></a><span class="type">void</span> QPainter::<span class="name">setViewport</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the painter's viewport rectangle to be the rectangle beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<!-- @@@setViewport -->
<!-- $$$setWindow[overload1]$$$setWindowconstQRect& -->
<h3 class="fn" id="setWindow"><a name="setWindow"></a><span class="type">void</span> QPainter::<span class="name">setWindow</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Sets the painter's window to the given <i>rectangle</i>, and enables view transformations.</p>
<p>The window rectangle is part of the view transformation. The window specifies the logical coordinate system. Its sister, the <a href="qpainter.html#viewport">viewport</a>(), specifies the device coordinate system.</p>
<p>The default window rectangle is the same as the device's rectangle.</p>
<p><b>See also </b><a href="qpainter.html#window">window</a>(), <a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(), and <a href="coordsys.html#window-viewport-conversion">Window-Viewport Conversion</a>.</p>
<!-- @@@setWindow -->
<!-- $$$setWindow$$$setWindowintintintint -->
<h3 class="fn" id="setWindow-1"><a name="setWindow-1"></a><span class="type">void</span> QPainter::<span class="name">setWindow</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the painter's window to the rectangle beginning at (<i>x</i>, <i>y</i>) and the given <i>width</i> and <i>height</i>.</p>
<!-- @@@setWindow -->
<!-- $$$setWorldMatrixEnabled[overload1]$$$setWorldMatrixEnabledbool -->
<h3 class="fn" id="setWorldMatrixEnabled"><a name="setWorldMatrixEnabled"></a><span class="type">void</span> QPainter::<span class="name">setWorldMatrixEnabled</span>(<span class="type">bool</span> <i>enable</i>)</h3>
<p>Enables transformations if <i>enable</i> is true, or disables transformations if <i>enable</i> is false. The world transformation matrix is not changed.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>(), <a href="qpainter.html#worldTransform">worldTransform</a>(), and <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@setWorldMatrixEnabled -->
<!-- $$$setWorldTransform[overload1]$$$setWorldTransformconstQTransform&bool -->
<h3 class="fn" id="setWorldTransform"><a name="setWorldTransform"></a><span class="type">void</span> QPainter::<span class="name">setWorldTransform</span>(const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;<i>matrix</i>, <span class="type">bool</span> <i>combine</i> = false)</h3>
<p>Sets the world transformation matrix. If <i>combine</i> is true, the specified <i>matrix</i> is combined with the current matrix; otherwise it replaces the current matrix.</p>
<p><b>See also </b><a href="qpainter.html#worldTransform">worldTransform</a>(), <a href="qpainter.html#transform">transform</a>(), and <a href="qpainter.html#setTransform">setTransform</a>().</p>
<!-- @@@setWorldTransform -->
<!-- $$$shear[overload1]$$$shearqrealqreal -->
<h3 class="fn" id="shear"><a name="shear"></a><span class="type">void</span> QPainter::<span class="name">shear</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sh</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sv</i>)</h3>
<p>Shears the coordinate system by (<i>sh</i>, <i>sv</i>).</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@shear -->
<!-- $$$strokePath[overload1]$$$strokePathconstQPainterPath&constQPen& -->
<h3 class="fn" id="strokePath"><a name="strokePath"></a><span class="type">void</span> QPainter::<span class="name">strokePath</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp;<i>pen</i>)</h3>
<p>Draws the outline (strokes) the path <i>path</i> with the pen specified by <i>pen</i></p>
<p><b>See also </b><a href="qpainter.html#fillPath">fillPath</a>() and <a href="qpainter.html#drawing">Drawing</a>.</p>
<!-- @@@strokePath -->
<!-- $$$testRenderHint[overload1]$$$testRenderHintQPainter::RenderHint -->
<h3 class="fn" id="testRenderHint"><a name="testRenderHint"></a><span class="type">bool</span> QPainter::<span class="name">testRenderHint</span>(<span class="type"><a href="qpainter.html#RenderHint-enum">QPainter::RenderHint</a></span> <i>hint</i>) const</h3>
<p>Returns <code>true</code> if <i>hint</i> is set; otherwise returns <code>false</code>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qpainter.html#renderHints">renderHints</a>() and <a href="qpainter.html#setRenderHint">setRenderHint</a>().</p>
<!-- @@@testRenderHint -->
<!-- $$$transform[overload1]$$$transform -->
<h3 class="fn" id="transform"><a name="transform"></a>const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;QPainter::<span class="name">transform</span>() const</h3>
<p>Alias for <a href="qpainter.html#worldTransform">worldTransform</a>(). Returns the world transformation matrix.</p>
<p><b>See also </b><a href="qpainter.html#setTransform">setTransform</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>
<!-- @@@transform -->
<!-- $$$translate[overload1]$$$translateconstQPointF& -->
<h3 class="fn" id="translate"><a name="translate"></a><span class="type">void</span> QPainter::<span class="name">translate</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>offset</i>)</h3>
<p>Translates the coordinate system by the given <i>offset</i>; i.e&#x2e; the given <i>offset</i> is added to points.</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and <a href="qpainter.html#coordinate-transformations">Coordinate Transformations</a>.</p>
<!-- @@@translate -->
<!-- $$$translate$$$translateconstQPoint& -->
<h3 class="fn" id="translate-1"><a name="translate-1"></a><span class="type">void</span> QPainter::<span class="name">translate</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>offset</i>)</h3>
<p>This is an overloaded function.</p>
<p>Translates the coordinate system by the given <i>offset</i>.</p>
<!-- @@@translate -->
<!-- $$$translate$$$translateqrealqreal -->
<h3 class="fn" id="translate-2"><a name="translate-2"></a><span class="type">void</span> QPainter::<span class="name">translate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i>)</h3>
<p>This is an overloaded function.</p>
<p>Translates the coordinate system by the vector (<i>dx</i>, <i>dy</i>).</p>
<!-- @@@translate -->
<!-- $$$viewTransformEnabled[overload1]$$$viewTransformEnabled -->
<h3 class="fn" id="viewTransformEnabled"><a name="viewTransformEnabled"></a><span class="type">bool</span> QPainter::<span class="name">viewTransformEnabled</span>() const</h3>
<p>Returns <code>true</code> if view transformation is enabled; otherwise returns false.</p>
<p><b>See also </b><a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>
<!-- @@@viewTransformEnabled -->
<!-- $$$viewport[overload1]$$$viewport -->
<h3 class="fn" id="viewport"><a name="viewport"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QPainter::<span class="name">viewport</span>() const</h3>
<p>Returns the viewport rectangle.</p>
<p><b>See also </b><a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>
<!-- @@@viewport -->
<!-- $$$window[overload1]$$$window -->
<h3 class="fn" id="window"><a name="window"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QPainter::<span class="name">window</span>() const</h3>
<p>Returns the window rectangle.</p>
<p><b>See also </b><a href="qpainter.html#setWindow">setWindow</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>
<!-- @@@window -->
<!-- $$$worldMatrixEnabled[overload1]$$$worldMatrixEnabled -->
<h3 class="fn" id="worldMatrixEnabled"><a name="worldMatrixEnabled"></a><span class="type">bool</span> QPainter::<span class="name">worldMatrixEnabled</span>() const</h3>
<p>Returns <code>true</code> if world transformation is enabled; otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a>(), <a href="qpainter.html#worldTransform">worldTransform</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<!-- @@@worldMatrixEnabled -->
<!-- $$$worldTransform[overload1]$$$worldTransform -->
<h3 class="fn" id="worldTransform"><a name="worldTransform"></a>const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;QPainter::<span class="name">worldTransform</span>() const</h3>
<p>Returns the world transformation matrix.</p>
<p><b>See also </b><a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>
<!-- @@@worldTransform -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
